[Haskell-beginners] http-client: Access response body of error responses

Sevcsik András sevcsik at gmail.com
Sun Jul 12 23:37:19 UTC 2015


Great, that did the trick. Thank you!

On Sun, Jul 12, 2015 at 10:28 PM Michael Snoyman <michael at snoyman.com>
wrote:

> Look at the docs on the checkStatus field of Request. It allows
> controlling whether an exception is thrown.
>
> On Sun, Jul 12, 2015, 11:32 AM Sevcsik András <sevcsik at gmail.com> wrote:
>
>> Hi list,
>>
>> Is there any way to read the response body of an >=400 HTTP response with
>> http-client?
>>
>> If the response is an error response, it throws a StatusCodeException
>> [1], which only exposes the headers, not the whole Response value.
>>
>> However, CouchDB gives a response body for the error responses,
>> describing the error, which I want to access.
>>
>> [1]:
>> https://hackage.haskell.org/package/http-client-0.2.1.1/docs/Network-HTTP-Client.html#v:StatusCodeException
>>
>> Cheers
>> --
>> Minden jót,
>> Sevcsik András
>>
> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-- 
Minden jót,
Sevcsik András
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150712/b95b74cf/attachment.html>


More information about the Beginners mailing list