Add headers(Consumer<HttpHeaders>) to RequestEntity and ResponseEntity

Closes gh-23404
This commit is contained in:
Arjen Poutsma
2019-08-22 15:05:14 +02:00
parent fbee3ed889
commit 8e4f2c89ff
4 changed files with 59 additions and 2 deletions

View File

@@ -106,6 +106,7 @@ public class RequestEntityTests {
ifNoneMatch(ifNoneMatch).
contentLength(contentLength).
contentType(contentType).
headers(headers -> assertThat(headers).hasSize(6)).
build();
assertThat(responseEntity).isNotNull();

View File

@@ -171,6 +171,7 @@ public class ResponseEntityTests {
location(location).
contentLength(contentLength).
contentType(contentType).
headers(headers -> assertThat(headers).hasSize(5)).
build();
assertThat(responseEntity).isNotNull();
@@ -219,7 +220,7 @@ public class ResponseEntityTests {
ResponseEntity<Void> responseEntityWithEmptyHeaders =
ResponseEntity.ok().headers(new HttpHeaders()).build();
ResponseEntity<Void> responseEntityWithNullHeaders =
ResponseEntity.ok().headers(null).build();
ResponseEntity.ok().headers((HttpHeaders) null).build();
assertThat(responseEntityWithEmptyHeaders.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseEntityWithEmptyHeaders.getHeaders().isEmpty()).isTrue();