diff --git a/libs/utils/src/main/java/com/akto/testing/ApiExecutor.java b/libs/utils/src/main/java/com/akto/testing/ApiExecutor.java index 1fffd835d3..6c3e2667c1 100644 --- a/libs/utils/src/main/java/com/akto/testing/ApiExecutor.java +++ b/libs/utils/src/main/java/com/akto/testing/ApiExecutor.java @@ -562,7 +562,7 @@ private static OriginalHttpResponse sendWithRequestBody(OriginalHttpRequest requ if (payload == null) payload = ""; if (body == null) {// body not created by GRPC block yet - if (request.getHeaders().containsKey("charset")) { + if (request.getHeaders().containsKey("charset") || isJsonRpcRequest(request)) { body = RequestBody.create(payload, null); request.getHeaders().remove("charset"); } else { @@ -747,6 +747,7 @@ private static void closeSseSession(SseSession session) throws InterruptedExcept } private static boolean shouldInitiateSSEStream(OriginalHttpRequest request) { + if (!isJsonRpcRequest(request)) { return false; } @@ -765,6 +766,10 @@ private static boolean shouldInitiateSSEStream(OriginalHttpRequest request) { } } } + // Check if x-akto-sse-endpoint header exists, return false if it doesn't + if (request.findHeaderValue("x-akto-sse-endpoint") == null) { + return false; + } return true; } }