It's nice that WebClient
and RestClient
provides 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
.