edgurgel / httpoison

Yet Another HTTP client for Elixir powered by hackney
https://hex.pm/packages/httpoison
MIT License
2.23k stars 341 forks source link

Spaces in url string are not being encoded by hackney #152

Open jeramyRR opened 8 years ago

jeramyRR commented 8 years ago

Spaces in a url string should be converted to %20 when calling HTTPoison.get, but it appears that this is not happening.

example: HTTPoison.get "http://api.openweathermap.org/data/2.5/weather?q=London, UK" should convert url to: http://api.openweathermap.org/data/2.5/weather?q=London,%20UK

ryanwinchester commented 6 years ago

This should encode properly if you do it like

HTTPoison.get(
  "http://api.openweathermap.org/data/2.5/weather",
  [],
  params: %{q: "London, UK"}
)
gushonorato commented 5 years ago

@ryanwinchester this doesn't solve the case when HTTPoison follows a redirect with an URL with spaces in Location header. This issue seems simple to solve but it's open for 2 years. Also, there's a pull request open that resolves this issue since 2016. Can I do something to help?

kamaroly commented 1 year ago

Thanks @ryanwinchester . Your solution worked well for me.