Comments (7)
Can you share the last line executed on HTTPoison code? Also which version are you using?
from httpoison.
Sure thing!
I'm using 0.4
and I'm calling HTTPoison.get("http://endpoint.herokuapp.com/long/api/path", headers)
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 :closed
and the response back, I got this from removing the raise
on body issues.
from httpoison.
So the issue might just be that HTTPoison only responds with the body only on {:ok, body}
and not {:closed, body}
as well?
from httpoison.
Found the issue:
HTTPoison is calling to_string
on this tuple. I think the right thing is to pass the reason as it's.
Adding this test on httpoison_base_test.exs
shows the issue:
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 to_string
: https://github.com/edgurgel/httpoison/blob/master/lib/httpoison/base.ex#L93-L94
from httpoison.
Sounds good, I think that's a much better way to approach the issue and was considering bringing it up.
from httpoison.
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.
from httpoison.
Thanks!
from httpoison.
Related Issues (20)
- 1.8 not installing HOT 1
- Response HOT 2
- Request is getting closed. HOT 2
- HTTPoison.MaybeRedirect for 308 status_code ? HOT 11
- why no_proxy doesn't support CIDR range format?
- checkout_failure when using httpoison with proxy HOT 3
- Lowercase location header not recognized when constructing %HTTPoison.MaybeRedirect{}
- TLS client: In state wait_cert_cr at ssl_handshake.erl:1984 generated CLIENT ALERT: Fatal - Unknown CA HOT 3
- SSL options replace default options (instead of just being added to them) HOT 2
- Default TLS version? HOT 2
- Proxy option not working HOT 1
- Hackney 1.18? HOT 1
- Overly loose typespecs
- HTTPoison.get! follow_redirect does not work with an async request HOT 1
- Nested form-encoded params don't work HOT 2
- "Path not supported by Algolia REST API" HOT 2
- How to contribute HOT 1
- ipv6 localhost address is passed to hackney without square brackets HOT 1
- Get HTTPoison.Error{reason: {:options, :dependency}} when send request with settings for tlsv1.3
- Issue Case clause error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpoison.