From 5e3757399bc8bdbf4d703cbe8f031ca7e6772e71 Mon Sep 17 00:00:00 2001 From: Steve Hu Date: Fri, 26 Jul 2024 13:51:29 -0400 Subject: [PATCH] fixes #2300 handler needs to escape the double quotes in the status description (#2301) --- .../src/main/java/com/networknt/handler/LightHttpHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler/src/main/java/com/networknt/handler/LightHttpHandler.java b/handler/src/main/java/com/networknt/handler/LightHttpHandler.java index 0d7093b153..bfee9c0308 100644 --- a/handler/src/main/java/com/networknt/handler/LightHttpHandler.java +++ b/handler/src/main/java/com/networknt/handler/LightHttpHandler.java @@ -114,7 +114,7 @@ default void setExchangeStatus(HttpServerExchange ex, Status status) { status = statusWrapper == null ? status : statusWrapper.wrap(status, ex); ex.setStatusCode(status.getStatusCode()); ex.getResponseHeaders().put(Headers.CONTENT_TYPE, ContentType.APPLICATION_JSON.value()); - status.setDescription(status.getDescription().replaceAll("\\\\", "\\\\\\\\")); + status.setDescription(status.getDescription().replaceAll("\\\\", "\\\\\\\\").replaceAll("\"", "\\\\\"")); var elements = Thread.currentThread().getStackTrace();