HttpEntity.EMPTY should be immutable
See gh-34812 Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
This commit is contained in:
committed by
rstoyanchev
parent
5013d6d771
commit
d7c13d6518
@@ -27,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @author Yanming Zhou
|
||||
*/
|
||||
class HttpEntityTests {
|
||||
|
||||
@@ -123,4 +124,11 @@ class HttpEntityTests {
|
||||
assertThat(requestEntity2).isEqualTo(requestEntity);
|
||||
}
|
||||
|
||||
@Test
|
||||
void emptyHttpEntityShouldBeImmutable() {
|
||||
HttpHeaders newHeaders = new HttpHeaders(HttpEntity.EMPTY.getHeaders());
|
||||
newHeaders.add("Authorization", "Bearer some-token");
|
||||
assertThat(HttpEntity.EMPTY.getHeaders().headerNames()).isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user