Skip to content

Expose HttpHeaders-style input in MockHttpServletRequestBuilder similar to RestClient and WebClient #35576

@rwinch

Description

@rwinch

It's nice that WebClient and RestClient provide access to the rich HttpHeaders object for setting things like HTTP Basic.

WebClient.create().get()
	.uri("/")
	.headers(h -> h.setBasicAuth("user", "password"))
        // ...

It would be nice if MockHttpServletRequest and MockHttpServletRequestBuilder exposed a method that allowed users to leverage HttpHeaders in a similar way as illustrated above.

NOTE: setHeaders(HttpHeaders) is not desirable because it requires setting all of the headers vs updating the existing HttpHeaders.

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions