-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Closed
Copy link
Labels
Milestone
Description
Andy Wilkinson opened SPR-15575 and commented
Assuming my understanding of the API is correct, I would expect this test to pass:
@Test
public void requestHeadersFromWebFilterAreAvailableFromExchangeResult() {
RouterFunction<ServerResponse> route = RouterFunctions
.route(RequestPredicates.GET("/"), (request) -> {
Assert.notEmpty(request.headers().header("FOO"), "FOO is required");
return ServerResponse.status(HttpStatus.OK).build();
});
WebTestClient client = WebTestClient.bindToRouterFunction(route)
.webFilter((exchange, chain) -> {
return chain.filter(exchange.mutate().request((builder) -> {
builder.header("FOO", "bar");
}).build());
}).build();
client.get().uri("/").exchange().expectStatus().isOk();
assertThat(client.get().uri("/").exchange().expectBody().returnResult()
.getRequestHeaders().getFirst("FOO"), is(notNullValue()));
}
It fails (with both RC1 and the latest snapshot) on the assertion at the end which checks that the FOO header is present in the ExchangeResult's request headers.
Affects: 5.0 RC1
Referenced from: commits 204a9cf