Skip to content

Add accessor for logPrefix in ClientResponse to allow tying a ClientRequest to a ClientResponse #24146

@epiwd

Description

@epiwd

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!

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions