Browse files

The newest Typhoeus release breaks backwards compat and requires down…

…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 c33a74ac37628f160c1fdce271e6853cce05fad8
Showing with 9 additions and 1 deletion.
  1. +9 −1 spec/support/http_library_adapters.rb
@@ -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
+ # 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] }
def make_http_request(method, url, body = nil, headers = {})

0 comments on commit c33a74a

Please sign in to comment.