From a9217017aeda3c03602a0bde2017543beaf36971 Mon Sep 17 00:00:00 2001 From: "daniel.naude" <danieln@bob.co.za> Date: Tue, 2 Jan 2024 13:24:59 +0200 Subject: [PATCH] Add moved permanantly 301 response --- responses/responses.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/responses/responses.go b/responses/responses.go index cf94854..41cbed3 100644 --- a/responses/responses.go +++ b/responses/responses.go @@ -2,9 +2,10 @@ package responses import ( "encoding/json" - "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/map_utils" "net/http" + "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/map_utils" + "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/logs" "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/utils" @@ -116,3 +117,10 @@ func OptionsResponse() events.APIGatewayProxyResponse { Headers: map_utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader), } } + +func MovedPermanentlyResponse(url string) events.APIGatewayProxyResponse { + return events.APIGatewayProxyResponse{ + StatusCode: http.StatusMovedPermanently, + Headers: map_utils.MergeMaps(utils.CorsHeaders(), map[string]string{"Location": url}), + } +} -- GitLab