Version 6.4.1
The docs located here show how to retrieve the body from the request with an exception but it seems that it is always null.
The code is
try
{
var json = await url.PostJsonToUrlAsync(employee, requestFilter: (r) => r.AddBearerToken(_apiKey));
}
catch (Exception ex)
{
var knownError = ex.IsBadRequest()
|| ex.IsNotFound()
|| ex.IsUnauthorized()
|| ex.IsForbidden()
|| ex.IsInternalServerError();
var isAnyClientError = ex.IsAny400();
var isAnyServerError = ex.IsAny500();
HttpStatusCode? errorStatus = ex.GetStatus();
string errorBody = ex.GetResponseBody();
// errorBody is always null even though the server is returning JSON
}
I confirmed this request with the server in postman is returning: