-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 methods to support more generalized interceptors #4868
Comments
Relates to:
|
It looks like we should add a method like "void afterSuccess(HttpResponse<?> response)" as you can get the request from the response. Allowing this to modify or return a different response does not seem like a good idea at this time - while there is the HttpResponseAdapter which makes it easy to change the response code / headers the only type that the response body can be is AsyncBody which would not be easy to manipulate and would like mean making another httpclient call. However it doesn't look like this would be ideal for logging, or at least not as good as putting the logging directly in the StandardHttpClient. Several considerations are:
Ideally we'd want users to be able to insert their own customized logging, but of course they'll hit those same issues. It seems like we may want to decouple this from the logging issue to put in something that just works into the StandardHttpClient and make more refinements to this proposal based upon any additional feedback from users. |
Somewhat tackled by #5037 |
I'd say what was introduced is good enough. The only bit of messiness is the StandardHttpClientBuilder controlling the addition of the logging interceptor, but that allows us to cover both configured and unconfigured clients. Someone may eventually want to inject their own override or other simiilar interceptor so we may have to introduce another factory method to do that. |
Is your enhancement related to a problem? Please describe
At least to support logging as an interceptor pattern, we should provide the ability for interceptors to get http responses as well.
Describe the solution you'd like
Add an afterSuccess method.
Specifically for logging we may want to think about how to provide details on payloads / responses without corrupting the streams.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: