Skip to content

Commit

Permalink
The newest Typhoeus release breaks backwards compat and requires down…
Browse files Browse the repository at this point in the history
…case header keys.

See typhoeus/typhoeus#227 for more info.

This is a hack that hopefully we won't have to do in the future, but it'll work for now.
  • Loading branch information
myronmarston committed Nov 20, 2012
1 parent c3561e1 commit c33a74a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spec/support/http_library_adapters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ def get_body_string(response)
alias get_body_object get_body_string

def get_header(header_key, response)
response.headers[header_key]
# Due to https://github.com/typhoeus/typhoeus/commit/256c95473d5d40d7ec2f5db603687323ddd73689
# headers are now downcased.
# ...except when they're not. I'm not 100% why (I haven't had time to dig into it yet)
# but in some situations the headers aren't downcased. I think it has to do with playback; VCR
# isn't sending the headers in downcased to typhoeus. It gets complicated with the interaction
# w/ WebMock, and the fact that webmock normalizes headers in a different fashion.
#
# For now this hack works.
response.headers.fetch(header_key.downcase) { response.headers[header_key] }
end

def make_http_request(method, url, body = nil, headers = {})
Expand Down

0 comments on commit c33a74a

Please sign in to comment.