Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/PortableRest/RestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,11 @@ private static async Task<T> GetResponseContent<T>([NotNull] RestRequest restReq
/// <returns></returns>
private static async Task<string> GetRawResponseContent([NotNull] HttpResponseMessage response)
{
//RWM: Explicitly check for NoContent... because the request was successful but there is nothing to do.
if (response.IsSuccessStatusCode && response.StatusCode != HttpStatusCode.NoContent)
//KW: If there's content I want to know what it is regardless of the wether the response has a success code
if (response.StatusCode != HttpStatusCode.NoContent)
{
return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
string stringContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
return string.IsNullOrEmpty(stringContent) ? null : stringContent;
}
return null;
}
Expand Down Expand Up @@ -468,7 +469,10 @@ private static T DeserializeResponseContent<T>([NotNull] RestRequest restRequest
}
catch (JsonSerializationException jEx)
{
throw new PortableRestException("The JsonConverter failed. Please see InnerException for details.", jEx);
var prEx = new PortableRestException(
"The JsonConverter failed. Please see InnerException " +
$"for details. StatusCode {response.StatusCode} : ReasonPhrase {response.ReasonPhrase}", jEx);
throw prEx;
}
}

Expand Down