You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suggest that the documentation be more explicit on what responses result in exception.
In particular, what status codes result in an exception? What statuses are the responsibility of client code?
I see a lens for checkResponse that I suspect gives some control. But in defaults the value for it is Nothing and yet get throws exceptions on non-200 statuses. I can't find much documentation of that option, either.
The text was updated successfully, but these errors were encountered:
Hey @aztecrex! I just ran into this too (I was very surprised that non 200 statuses were raised as exceptions). This is how I ended up using checkResponse:
When I started using this for requests, it didn't raise exceptions anymore.
@bos I'd love to see a quick section in <www.serpentine.com/wreq/tutorial.html> referencing this snippet. Most of the other http client's I'm familiar with (Python's requests, JavaScript's fetch, ...) don't raise. A quick note about how to get back to the no-raise behavior would be great.
Curious about what's going on here? It looks like the checkResponse option is just forwarded to the underlying http-client library that wreq abstracts over. In particular, if we look at that package's documentation, we see:
--| Modify the request so that non-2XX status codes do not generate a runtime-- 'StatusCodeException'.---- @since 0.4.29setRequestIgnoreStatus::Request->Request
setRequestIgnoreStatus req = req { checkResponse =\_ _ ->return() }
So that's where I got the idea for the snippet I posted above.
Suggest that the documentation be more explicit on what responses result in exception.
In particular, what status codes result in an exception? What statuses are the responsibility of client code?
I see a lens for
checkResponse
that I suspect gives some control. But indefaults
the value for it isNothing
and yetget
throws exceptions on non-200 statuses. I can't find much documentation of that option, either.The text was updated successfully, but these errors were encountered: