From a0afa08f8041ccb5db2bff8904e4bc5c15816ad9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?France=CC=81=20Wilke?= <francewilke@gmail.com>
Date: Thu, 28 Oct 2021 08:55:43 +0200
Subject: [PATCH] Respond with status code 204 for DELETE request methods

---
 api/lambda.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/api/lambda.go b/api/lambda.go
index d18f131..c229eef 100644
--- a/api/lambda.go
+++ b/api/lambda.go
@@ -258,7 +258,12 @@ func (api Api) Handler(baseCtx context.Context, apiGatewayProxyReq events.APIGat
 
 	//handler succeeded, some handler does not have a response data (typically post/put/patch/delete)
 	err = nil
-	res.StatusCode = http.StatusOK
+	switch apiGatewayProxyReq.HTTPMethod {
+	case http.MethodDelete:
+		res.StatusCode = http.StatusNoContent
+	default:
+		res.StatusCode = http.StatusOK
+	}
 
 	if len(results) > 1 {
 		responseStruct := results[0].Interface()
-- 
GitLab