Skip to content

InterceptingClientHttpRequest replaces headers set in request factory instead of merging them [SPR-15166] #19732

@spring-projects-issues

Description

@spring-projects-issues

Nestor Tarin Burriel opened SPR-15166 and commented

When a custom requestFactory adds a header to the request and the RequestEntity contains the same header (e.g. cookies), the one in the RequestEntity will take precedence.

Checking the code in InterceptingClientHttpRequest class:

ClientHttpRequest delegate = requestFactory.createRequest(request.getURI(), request.getMethod());
getHeaders().putAll(request.getHeaders());

Is this the desired behaviour? Would it be ok if the header values are added? What if the custom request factory wants to add a cookie and the request header adds a different cookie? (the last one will be in the header and the first one discarded)

Kind regards,

Néstor


Affects: 4.2.6

Referenced from: commits 9243a14, e3be94c, 69c16f3

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions