-
Notifications
You must be signed in to change notification settings - Fork 337
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
JSON response causes error #26
Comments
Can you share the last line executed on HTTPoison code? Also which version are you using? |
Sure thing! I'm using Turns out the request succeeds locally where I don't have much data, but it seems to fail when I hit the remote endpoint which has a bit larger amount. It's nothing ridiculous though. Sorry for the poor error report, it's late and I didn't know if this would actually get addressed any time soon. Hackney gave |
So the issue might just be that HTTPoison only responds with the body only on |
Found the issue: HTTPoison is calling Adding this test on test "request failing with a error reason tuple" do
expect(:hackney, :request, 5, {:error, {:closed, "Something happened"}})
assert_raise HTTPoison.HTTPError, "...", fn ->
HTTPoison.post("localhost", "body")
end
assert validate :hackney
end Speaking of this, I'm also considering (as a breaking change) to not raise errors, just return a HTTPError struct. It would have a better behaviour and perfect for just pattern matching. I'll open an issue as "discussion". Edited to add the place where we call |
Sounds good, I think that's a much better way to approach the issue and was considering bringing it up. |
Released a new version with this fix: https://github.com/edgurgel/httpoison/releases/tag/0.4.3 , https://hex.pm/packages/httpoison/0.4.3 0.5.* may not have exceptions anymore. |
Thanks! |
I'm trying to consume a JSON API and I get this error,
** (Protocol.UndefinedError) protocol String.Chars not implemented for {:closed, "{
.The rest of it's just a bunch of JSON. Any ideas?
The text was updated successfully, but these errors were encountered: