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-issuemaster opened this issue Jan 19, 2017 · 2 comments

Comments

@spring-issuemaster
Copy link
Collaborator

commented Jan 19, 2017

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 30, 2017

Arjen Poutsma commented

Fixed in master, see 69c16f3

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 31, 2017

Juergen Hoeller commented

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.