Open hartmark opened 4 months ago
We added this workaround extension method so we catch all errors when checking IApiResponse:
public static class ApiResponseExtensions
{
public static bool IsReallySuccessful<T>(this IApiResponse<T> response)
{
return response.IsSuccessStatusCode && response.Error == null;
}
public static bool IsReallySuccessful(this IApiResponse response)
{
return response.IsSuccessStatusCode && response.Error == null;
}
}
found the same too https://github.com/reactiveui/refit/pull/1303
Describe the bug 🐞
We noticed that if you get any serialization errors IsSuccessStatusCode is still true for ApiResponse, but Error is not-null because of error in serialization.
We have this reproducing code. Using xunit and RichardSzalay.MockHttp.
Step to reproduce
Create a class using this code and run the unit-test:
Reproduction repository
No response
Expected behavior
response.Error should not be null when IsSuccessStatusCode is true
Screenshots 🖼️
No response
IDE
No response
Operating system
No response
Version
No response
Device
No response
Refit Version
7.0.0
Additional information ℹ️
No response