-
Notifications
You must be signed in to change notification settings - Fork 340
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
URI.encode the input url #195
Conversation
This ensures that URLs that are pssed in with paramters that include spaces are properly URI encoded. This is a potentially breaking change for people who are already encoding URLs before passing them to HTTPoison.
I forgot o mention that this is a fix for issue #152 |
First, thanks for the contribution! 👍 🎉 Awesome! I was quite confident that hackney had the encoding of URL done there. I need to double check! I'm fine breaking changes as long as we bump the major version 👌 I'm keen to make HTTPoison work fine with the upcoming Elixir 1.4.0 then releasing |
You're welcome! Looking in hackney's NEWS.md file (in the deps directory) there is a fix to version 1.1.1 to not encode path parameters. I think you are right. Hackney encodes urls. but just the path, not parameters. I may be wrong. I don't know erlang well enough to be sure. A better fix may be to split the url on ? and if there is anything in the second part, encode that and recombine the parts. This would prevent possibly encoding the URL domain and path twice. |
Oh, and yeah. I find HTTPoison stable. I use it to access a backend rest service and haven't had any issues. HTTPoison is usually the second package I add after phoenix and/or poison. :) |
One could argue that this is also a bug with the Elixir encode query right?: URI.encode_query(%{ baz: "bong", foo: "bar stool"})
"baz=bong&foo=bar+stool" so |
I think either + or %20 is OK IIRC. URL encoding always seemed a little wonky to me. :) |
@edgurgel @baldmountain using HTML spec (RFC-1866) on form submission8.2.1. The form-urlencoded Media TypeThe default encoding for all forms is
W3C Form content typesapplication/x-www-form-urlencodedThis is the default content type. Forms submitted with this content type must be encoded as follows:
|
This ensures that URLs that are passed in with parameters that include spaces are
properly URI encoded.
This is a potentially breaking change for people who are already encoding URLs. Because it is a potentially breaking change, the right fix may be to update the documentation to say that URLs should be URI.encoded before being passed to HTTPoison.