-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Ability to edit Response body in interceptor #124
Comments
This is a great idea. I'm looking into it, as it would enable body parsing, but it's a complex operation and there may be some features that get affected and some even might get deprecated. |
Yes, this would be great! I actually tried overriding the response body, however, it's not working:
|
Sorry, what version of the package are you using @mohamed155 ? I made some tests for this in the beta releases and just want to double-check if the tests are not covering this scenario for some reason. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi @CodingAleCR، i'm using the version 1.0.2 |
@mohamed155 There were a couple of fixes included into beta versions of 2.0.0 that might have not been replicated to 1.x versions. In any case there's a stable version 2.x that could fix your issues and improve a bunch of other things. |
Since the HTTP Response body is a getter, we need a way to modify the Response body after it's fetched.
For example:
`
class APIInterceptors extends InterceptorContract {
@OverRide
Future interceptRequest({required RequestData data}) async {
return data;
}
@OverRide
Future interceptResponse({required ResponseData data}) async {
data.body = someMethodMakeSomeModifications(data.body);
return data;
}
}
`
The text was updated successfully, but these errors were encountered: