Closed artempyanykh closed 5 years ago
If you don’t want to define an instance of MonadHttp
you can always use runReq
and pass HttpConfig
there directly. In the config you’ll need to set httpConfigCheckResponse
to something like \_ _ _ -> Nothing
.
Does this answer your question? Can we close this one?
Ah, I see. Thank you very much for helping @mrkkrp, good to close!
This is also shown in the docs and readme 😉
@mrkkrp right, just checked Haddock and found mentions of httpConfigCheckResponse
. However, in README I couldn't find anything except
Just define handleHttpException accordingly when making your monad instance of MonadHttp and it will play together seamlessly.
Maybe it's worth adding a small note or example? TBH, I was pretty surprised to receive an exception on non-200 response, not exactly the default of a least surprise.
Anyway, sorry for the silly question. I'm new to Haskell and its ecosystem and failed to figure out from the first try how http-client
and req
play together ¯\_(ツ)_/¯
Ah, sorry I just was thinking about runReq
itself vs defining a new instance. Never mind.
With vanilla Network.HTTP.Client one can just
setRequestIgnoreStatus
. It looks like that with req I'd need to defineMonadHttp
withhandleHttpException
, but this looks like too much hassle if I just want to run requests in IO and handle all responses irregardless of their status codes.Am I missing something in the config?