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 accessor for logPrefix in ClientResponse to allow tying a ClientRequest to a ClientResponse #24146
Comments
I don't it's a good idea to expose the We could, however, expose the |
The |
If the HttpRequest were available in the ClientResponse, that would work as well. (To be even more explicit, we're trying to use ExchangeFilterFunctions to create a log line using both the request and response, but there's seemingly nothing built-in that can tie a request to a response.) |
In the public API you mean. Indeed it does seem like a missing link there for further logging downstream, e.g. in an onStatus handler or when handling a |
I did not know that If you (or anyone else) would like to see |
Thanks for the fast turnaround! |
Affects: spring-framework:spring-webflux:5.1.9.RELEASE
Hello,
I have a use case while making webclient requests where we use parts of the clientrequest and clientresponse together to form a log. In the clientRequest, logPrefix is an accessible unique identifier that is passed from the request to the response, yet when we try to do the same for the clientResponse, the field is present but not accessible.
We've considered a workaround where we create a custom ExchangeFunction that forces the logPrefix id into the headers of the clientRequest so that it can be read in the response, but even then, DefaultClientResponse is package-protected, which makes creating the ExchangeFunction difficult.
There is also a possibility we've overlooked a solution for this, so if there's a way to easily tie together a webclient request and response, please let me know.
If not, our proposed fix is simply to expose the logPrefix like all the other clientResponse fields.
Thank you!
The text was updated successfully, but these errors were encountered: