Module: AuthHMAC::Headers
- Included in:
- AuthHMAC, CanonicalString
- Defined in:
- lib/auth-hmac.rb
Overview
:nodoc:
Instance Method Summary collapse
- #find_header(keys, headers) ⇒ Object
-
#headers(request) ⇒ Object
Gets the headers for a request.
Instance Method Details
#find_header(keys, headers) ⇒ Object
43 44 45 46 47 |
# File 'lib/auth-hmac.rb', line 43 def find_header(keys, headers) keys.map do |key| headers[key] end.compact.first end |
#headers(request) ⇒ Object
Gets the headers for a request.
Attempts to deal with known HTTP header representations in Ruby. Currently handles net/http and Rails.
33 34 35 36 37 38 39 40 41 |
# File 'lib/auth-hmac.rb', line 33 def headers(request) if request.respond_to?(:headers) request.headers elsif request.respond_to?(:[]) request else raise ArgumentError, "Don't know how to get the headers from #{request.inspect}" end end |