Remove headers(HttpHeaders)

This commit removes the headers(HttpHeaders) method on ClientRequest and
ServerResponse, in favor of headers(Consumer<HttpHeaders>), which is
more flexible.
This commit is contained in:
Arjen Poutsma
2017-06-12 14:14:40 +02:00
parent 9bf82dc18f
commit 424bc75fb1
6 changed files with 23 additions and 52 deletions

View File

@@ -253,10 +253,12 @@ public class DefaultServerResponseBuilderTests {
@Test
public void headers() throws Exception {
HttpHeaders headers = new HttpHeaders();
Mono<ServerResponse> result = ServerResponse.ok().headers(headers).build();
HttpHeaders newHeaders = new HttpHeaders();
newHeaders.set("foo", "bar");
Mono<ServerResponse> result =
ServerResponse.ok().headers(headers -> headers.addAll(newHeaders)).build();
StepVerifier.create(result)
.expectNextMatches(response -> headers.equals(response.headers()))
.expectNextMatches(response -> newHeaders.equals(response.headers()))
.expectComplete()
.verify();