appcues / mojito

An easy-to-use Elixir HTTP client, built on the low-level Mint library.
https://hexdocs.pm/mojito/Mojito.html
MIT License
349 stars 34 forks source link

Mojito fails to send if the query string has %7B in it #13

Closed intentionally-left-nil closed 5 years ago

intentionally-left-nil commented 5 years ago

I will dig more into why this happens, but here's my minimal repro:

It doesn't make any outgoing request, but fails with :invalid_request_target

iex(2)> Mojito.request(:get, "http://localhost:4000/?r=%7B")

18:28:55.479 [debug] Mojito.ConnServer #PID<0.361.0>: get http://localhost:4000/?r=%7B

18:28:55.481 [debug] Mojito.ConnServer #PID<0.361.0>: cleaning up {:error, %Mojito.Error{ message: {:error, %Mint.HTTP1{ buffer: "", host: "localhost", private: %{}, request: nil, requests: {[], []}, socket: #Port<0.13>, state: :open, transport: Mint.Core.Transport.TCP }, :invalid_request_target}, reason: :unknown }}

intentionally-left-nil commented 5 years ago

This is fixed by https://github.com/ericmj/mint/issues/110

Once mint snaps a new 0.2 release, can you update mojito with this fix?

intentionally-left-nil commented 5 years ago

Update: Mint has a 0.2 release now

axelson commented 5 years ago

This library was updated to Mint 0.2 in https://github.com/appcues/mojito/commit/0c26e79e259d9ef787a99559784c0f4cab26d555 so I believe this can be closed