-
-
Notifications
You must be signed in to change notification settings - Fork 746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IsSuccessful property to ApiResponse #1891
Conversation
Introduce IsSuccess property to ApiResponse<T> and related interfaces to indicate request success. Add EnsureSuccessAsync method to handle errors, including deserialization issues. Refactor EnsureSuccessStatusCodeAsync to use ThrowsApiExceptionAsync. Update Dispose method for exception handling. Add unit tests to verify new behavior.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1891 +/- ##
==========================================
- Coverage 87.73% 84.32% -3.41%
==========================================
Files 33 36 +3
Lines 2348 2482 +134
Branches 294 348 +54
==========================================
+ Hits 2060 2093 +33
- Misses 208 310 +102
+ Partials 80 79 -1 ☔ View full report in Codecov by Sentry. |
Renamed properties and methods related to the success status of an API response in the `Refit` library: - `IsSuccess` to `IsSuccessful` - `EnsureSuccessAsync` to `EnsureSuccessfulAsync`
Added a new test method `When_SerializationErrorOnSuccessStatusCode_EnsureSuccesStatusCodeAsync_DoNotThrowApiException` to verify that `EnsureSuccessStatusCodeAsync` does not throw an `ApiException` on deserialization error with a success status code. Included assertions to check response status and error presence. Enhanced existing test method `When_SerializationErrorOnSuccessStatusCode_EnsureSuccessfulAsync_ThrowsApiException` with additional assertions.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What kind of change does this PR introduce?
This PR adds a new
IsSuccessful
property toApiResponse
, that tells if the HTTP call has succeeded and there wasn't any other error (for example, during response deserialization).What is the current behavior?
See #1694
What might this PR break?
Nothing, this a new feature that does not impact the existing applications.
Please check if the PR fulfills these requirements
Other information:
Closes #1694