Skip to content

MockHttpServletRequest.protocol default should be "HTTP/1.1", not "http" [SPR-15232] #19797

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

Closed
spring-projects-issues opened this issue Feb 8, 2017 · 0 comments
Assignees
Labels
in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Feb 8, 2017

Adam Michalik opened SPR-15232 and commented

ServletRequest.getProtocol() JavaDoc says

Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.

However, MockHttpServletRequest.protocol defaults to "http" which violates the contract of the JavaDoc.

There is no way to override this default when using MockMvc and MockHttpServletRequestBuilder, so the default MockHttpServletRequest.protocol should rather be "HTTP/1.1" so that it better resembles a real-life HTTP request.


Affects: 4.3.6

Issue Links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module 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