From d5176db3ebd02037580b3d7836b9c6a5d01ec8ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=C3=A9=20Wilke?= <francewilke@gmail.com> Date: Thu, 15 Feb 2024 14:12:53 +0200 Subject: [PATCH] Add TimeResponse to api_responses --- api_responses/api_responses.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api_responses/api_responses.go b/api_responses/api_responses.go index bd6d4de..2138361 100644 --- a/api_responses/api_responses.go +++ b/api_responses/api_responses.go @@ -3,6 +3,7 @@ package api_responses import ( "encoding/json" "fmt" + "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/date_utils" "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors" "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/map_utils" "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/string_utils" @@ -291,3 +292,12 @@ func GenericJSONResponseWithMessage(code int, err error) events.APIGatewayProxyR Headers: map_utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader), } } + +func TimeResponse() events.APIGatewayProxyResponse { + currentTime, _ := json.Marshal(date_utils.CurrentDate()) + return events.APIGatewayProxyResponse{ + StatusCode: http.StatusOK, + Body: string(currentTime), + Headers: map_utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader), + } +} -- GitLab