Closed
Description
I don't know if it is by design, but it makes impossible to deserialize error in response - because the RequestBuilderImplementation,BuildCancellableTaskFuncForMethod
already closed the response stream.
With such a behavior this issue #531 can't be done using ApiResponse as suggested here
btw it's not so cool to get the error using try-catch (see the code)
public static async Task<TError> GetErrorAsync<TResponse, TError>(this ApiResponse<TResponse> apiResponse)
{
if (!apiResponse.IsSuccessStatusCode)
{
try
{
await apiResponse.EnsureSuccessStatusCodeAsync().ConfigureAwait(false);
}
catch (ApiException e)
{
var errorAsync = e.GetContentAs<TError>();
return errorAsync;
}
}
return default(TError);
}