How to get to body of HTTP 500 error with std.net.curl.get()?

Andre Pany andre at s-e-a-p.de
Fri Feb 14 13:23:01 UTC 2020


On Friday, 14 February 2020 at 00:24:27 UTC, Gregor Mückl wrote:
> Hi!
>
> I am trying to write a client for pretty... well... creatively 
> designed web API. The server gives HTTP status 500 replies if 
> the requests are malformed, but the actual error message is 
> hidden in the body of the reply (an XML document!). 
> std.net.curl.get() throws an exception in this case. But I 
> would like to get the body to process the error message within. 
> How can I do that?
>
> Thanks in advance,
> Gregor

Hi Gregor,

If I am not completely wrong, the exception has an attribute
"msg" which should contain the body of the http response.

Kind regards
André


More information about the Digitalmars-d-learn mailing list