From 5e3422fb24ef4d65b1b218248f80f818c6570bdc Mon Sep 17 00:00:00 2001 From: "mayur.popli" Date: Thu, 20 Mar 2025 09:07:43 +0530 Subject: [PATCH] feat: req preprocessor --- .../requestPreProcessor/reqpreprocessor_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/shared/plugin/implementation/requestPreProcessor/reqpreprocessor_test.go b/shared/plugin/implementation/requestPreProcessor/reqpreprocessor_test.go index 47e46e0..483714d 100644 --- a/shared/plugin/implementation/requestPreProcessor/reqpreprocessor_test.go +++ b/shared/plugin/implementation/requestPreProcessor/reqpreprocessor_test.go @@ -24,8 +24,8 @@ func TestNewUUIDSetter(t *testing.T) { }, requestBody: map[string]any{ "context": map[string]any{ - "transaction_id": "", - "message_id": nil, + "transaction_id": "", + "message_id": nil, }, }, expectedCode: http.StatusOK, @@ -38,8 +38,8 @@ func TestNewUUIDSetter(t *testing.T) { }, requestBody: map[string]any{ "context": map[string]any{ - "transaction_id": "existing-transaction", - "message_id": "existing-message", + "transaction_id": "existing-transaction", + "message_id": "existing-message", }, }, expectedCode: http.StatusOK, @@ -107,7 +107,10 @@ func TestNewUUIDSetter(t *testing.T) { // Define a dummy handler dummyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) - io.Copy(w, r.Body) + if _, err := io.Copy(w, r.Body); err != nil { + http.Error(w, "Failed to copy request body", http.StatusInternalServerError) + return + } }) // Apply middleware