Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
gcbeattyAWS committed Dec 12, 2024
1 parent 29f9954 commit c35a689
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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\"}";
Expand All @@ -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<string, string>? headers, string? body, int statusCode)
Expand Down

0 comments on commit c35a689

Please sign in to comment.