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

Use bytesize instead of length to determine Content-Length #206

Closed
KidkArolis opened this issue May 1, 2013 · 3 comments
Closed

Use bytesize instead of length to determine Content-Length #206

KidkArolis opened this issue May 1, 2013 · 3 comments

Comments

@KidkArolis
Copy link

If body_json is a string that contains £ symbol, Content-Length header will be set incorrectly by HTTParty. See https://github.com/typhoeus/typhoeus, they handle that correctly.

response = HTTParty.post(endpoint,
  :headers => {
    'Content-Type' => 'application/json; charset=UTF-8'
  },
  :body => body_json
)
@jnunemaker
Copy link
Owner

Any concerns about backwards compatibility for a change like this? Also, a pull request would certainly help.

@commel
Copy link

commel commented Jul 3, 2014

Would this lead to EOF when sending to an webserver?

@TheSmartnik
Copy link
Collaborator

Pretty sure, back in the time, it was a problem with Net/HTTP in ruby 1.9.3. Since 2.0 bytesize is used to determine set Content-Length

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

4 participants