Skip to content
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

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

Closed
spring-projects-issues opened this issue Jan 19, 2017 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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

@spring-projects-issues
Copy link
Collaborator Author

Arjen Poutsma commented

Fixed in master, see 69c16f3

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Backported to 4.3.7 now, in a slightly different form (without the new method on MultiValueMap).

@spring-projects-issues spring-projects-issues added type: bug A general bug in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3.7 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants