From 084eb6d4dd2d071423b3b6d1251874ecfbd0c77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= <58428711+pj892031@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:02:16 +0100 Subject: [PATCH] fix: do not fail when headers can't be modified (#3845) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš Co-authored-by: achmelo <37397715+achmelo@users.noreply.github.com> --- .../gateway/controllers/GatewayExceptionHandler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gateway-service/src/main/java/org/zowe/apiml/gateway/controllers/GatewayExceptionHandler.java b/gateway-service/src/main/java/org/zowe/apiml/gateway/controllers/GatewayExceptionHandler.java index 6eac086a0a..895b8e7fc1 100644 --- a/gateway-service/src/main/java/org/zowe/apiml/gateway/controllers/GatewayExceptionHandler.java +++ b/gateway-service/src/main/java/org/zowe/apiml/gateway/controllers/GatewayExceptionHandler.java @@ -72,8 +72,12 @@ public Mono 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 {