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

Encoding Incorrect when Streaming Response #643

Closed
mvastola opened this issue Feb 3, 2019 · 4 comments
Closed

Encoding Incorrect when Streaming Response #643

mvastola opened this issue Feb 3, 2019 · 4 comments

Comments

@mvastola
Copy link

mvastola commented Feb 3, 2019

I'm running into an issue where the encoding is not set according to the response HTTP headers when using :stream_body => true.

I've provided a minimal reproducible example in a gist at https://git.io/fhSBB.

In short, if I look at req.headers['content-type'] I (correctly) see ["text/html;charset=UTF-8"] and req.body.encoding returns UTF-8. However, for whatever reason, fragment.encoding (fragment being the argument to the block provided to HTTParty.get(URL, :stream_body => true) ) is ASCII-8BIT.

Oddly, it works fine when not using streaming.

I'm happy to help troubleshoot this if there's any way I can be of help. Any assistance would be appreciated.

@TheSmartnik
Copy link
Collaborator

@mvastola Hi! Thanks for reporting. Yeah, you're right. Seems like we've forgot about this case.
I'll work on the issue in the nearest time and let you know as soon as it's fixed

@mvastola
Copy link
Author

mvastola commented Feb 3, 2019

Thanks so much!

@TheSmartnik
Copy link
Collaborator

@mvastola I've finally merged the request. Sorry to keep you waiting.
I'm not yet sure, when the new version of is going to be released. Before that, I suggest to fetch httparty directly from github with the following change in your Gemfile

gem 'httparty', github: 'jnunemaker/httparty'

@mvastola
Copy link
Author

No worries! Thanks again!

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

2 participants