From c35a689e5a676cb8d0b8169004d3dc224af42ab7 Mon Sep 17 00:00:00 2001 From: Garrett Beatty Date: Thu, 12 Dec 2024 17:09:51 -0500 Subject: [PATCH] clean up code --- .../Extensions/ApiGatewayResponseExtensions.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Extensions/ApiGatewayResponseExtensions.cs b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Extensions/ApiGatewayResponseExtensions.cs index 0965935e0..5c05f8f26 100644 --- a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Extensions/ApiGatewayResponseExtensions.cs +++ b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Extensions/ApiGatewayResponseExtensions.cs @@ -100,9 +100,13 @@ private static void SetContentTypeAndStatusCode(HttpResponse response, IDictiona response.ContentType = contentType; } - // In v1 if no status code is provided then it will automatically error to 500 - if (statusCode == 0) + if (statusCode != 0) + { + response.StatusCode = statusCode; + } + else { + // In v1 if no status code is provided then it will automatically error to 500 statusCode = 500; response.ContentType = "application/json"; var errorBody = "{\"message\":\"Internal Server Error\"}"; @@ -111,10 +115,6 @@ private static void SetContentTypeAndStatusCode(HttpResponse response, IDictiona response.ContentLength = errorBytes.Length; response.StatusCode = statusCode; } - else - { - response.StatusCode = statusCode; - } } private static void SetContentTypeAndStatusCodeV2(HttpResponse response, IDictionary? headers, string? body, int statusCode)