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

Allow setting headers in MockHttpServletRequest [SPR-17391] #21924

Closed
spring-projects-issues opened this issue Oct 16, 2018 · 2 comments
Closed

Allow setting headers in MockHttpServletRequest [SPR-17391] #21924

spring-projects-issues opened this issue Oct 16, 2018 · 2 comments
Assignees
Labels
in: test in: web status: declined type: enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Oct 16, 2018

João Cabrita opened SPR-17391 and commented

Currently only supports adding headers, with special replacement logic for the Content-Type and Accept-Language headers.

 

My use case is setting a default value for any header (potentially a non-standard one) but override it in a post processor or request builder.

 


Affects: 5.0.5

Issue Links:

  • #21828 Support for removeHeader in MockHttpServletRequest
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 16, 2018

Juergen Hoeller commented

We recently introduced a removeHeader method on MockHttpServletRequest which should allow you to implement replacement logic as described. This is available in yesterday's 5.1.1, 5.0.10 and 4.3.20 releases. In that sense, the existing arrangement should be sufficient here.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 16, 2018

João Cabrita commented

That does work, I missed it when reviewing the latest.

Thanks!

@spring-projects-issues spring-projects-issues added status: declined in: test type: enhancement in: web labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test in: web status: declined type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants