Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response with Content-Encoding but empty body breaks #247

Closed
ghostganz opened this issue Oct 22, 2013 · 5 comments
Closed

Response with Content-Encoding but empty body breaks #247

ghostganz opened this issue Oct 22, 2013 · 5 comments

Comments

@ghostganz
Copy link

I have a service that gives 304 Not Modified responses and has a response header "Content-Encoding: gzip" at the same time. (Arguably a bug in Rack::Deflate, but that's another story).

Since the 304 response has no body, HTTParty chokes when trying to decompress the body:

httparty (0.12.0) lib/httparty/request.rb:272:in `initialize'
httparty (0.12.0) lib/httparty/request.rb:272:in `new'
httparty (0.12.0) lib/httparty/request.rb:272:in `handle_deflation'
httparty (0.12.0) lib/httparty/request.rb:106:in `perform'
httparty (0.12.0) lib/httparty.rb:486:in `perform_request'
httparty (0.12.0) lib/httparty.rb:423:in `get'
httparty (0.12.0) lib/httparty.rb:518:in `get'
...

The failing line in HTTParty:

body_io = StringIO.new(last_response.body)
@ghostganz
Copy link
Author

Actually Rack::Deflate is innocent, we have a strangely configured proxy I think. Still, it would be nice if HTTParty could handle it.

@jnunemaker
Copy link
Owner

Yeah, does not seem like an httparty bug per say but we can probably handle it more gracefully. What is the actual error? You have the backtrace but not the exception.

@ghostganz
Copy link
Author

Sorry, it's TypeError with "can't convert nil into String".

@rusikf
Copy link

rusikf commented Jan 6, 2015

@ghostganz can you provide failing test for this issue ?

@jnunemaker
Copy link
Owner

I think #530 closes this. Closing but let me know if I'm wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants