Copy headers map in RestClientResponseException to ensure serializability

This commit ensures that the HttpHeaders used are serializable by making
 a copy.

Closes gh-31787
This commit is contained in:
Arjen Poutsma
2023-12-11 12:57:09 +01:00
parent 7432a96b48
commit 57b8100a06
2 changed files with 20 additions and 2 deletions

View File

@@ -74,7 +74,7 @@ public class DefaultResponseErrorHandlerTests {
assertThatExceptionOfType(HttpClientErrorException.class)
.isThrownBy(() -> handler.handleError(response))
.withMessage("404 Not Found: \"Hello World\"")
.satisfies(ex -> assertThat(ex.getResponseHeaders()).isSameAs(headers));
.satisfies(ex -> assertThat(ex.getResponseHeaders()).isEqualTo(headers));
}
@Test