Skip to content

Commit

Permalink
fix: do not fail when headers can't be modified (#3845)
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Jareš <[email protected]>
Co-authored-by: achmelo <[email protected]>
  • Loading branch information
pj892031 and achmelo authored Oct 29, 2024
1 parent 945fc9c commit 084eb6d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ public Mono<Void> setBodyResponse(ServerWebExchange exchange, int responseCode,
var serverCodecConfigurer = ServerCodecConfigurer.create();

var serverWebExchange = new DefaultServerWebExchange(exchange.getRequest(), exchange.getResponse(), sessionManager, serverCodecConfigurer, localeContextResolver);
serverWebExchange.getResponse().setRawStatusCode(responseCode);
serverWebExchange.getResponse().getHeaders().add(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON_VALUE);
try {
serverWebExchange.getResponse().setRawStatusCode(responseCode);
serverWebExchange.getResponse().getHeaders().add(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON_VALUE);
} catch (UnsupportedOperationException e) {
log.debug("Cannot update response", e);
}

Message message = messageService.createMessage(messageCode, args);
try {
Expand Down

0 comments on commit 084eb6d

Please sign in to comment.