Skip to content

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

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulein: 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