Class: Rack::Idempotency::Request

Inherits:
Request
  • Object
show all
Defined in:
lib/rack/idempotency/request.rb

Instance Method Summary collapse

Instance Method Details

#idempotency_keyObject



6
7
8
9
10
11
12
# File 'lib/rack/idempotency/request.rb', line 6

def idempotency_key
  get_header("HTTP_IDEMPOTENCY_KEY").tap do |key|
    unless key.nil? || key.match?(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)
      raise InsecureKeyError.new(env), 'Idempotency-Key must be a valid UUID'
    end
  end
end