From 6fdf34a50806e06c0f6a8b7eced0fa77daa6e575 Mon Sep 17 00:00:00 2001 From: Trevor Bramwell Date: Thu, 2 May 2024 15:21:07 -0700 Subject: [PATCH] AWS Lambda: Fix validation issues Signed-off-by: Trevor Bramwell --- pkg/middlewares/awslambda/aws_lambda.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/pkg/middlewares/awslambda/aws_lambda.go b/pkg/middlewares/awslambda/aws_lambda.go index cecaa3082e..feb6becc76 100644 --- a/pkg/middlewares/awslambda/aws_lambda.go +++ b/pkg/middlewares/awslambda/aws_lambda.go @@ -164,7 +164,7 @@ func (a *awsLambda) ServeHTTP(rw http.ResponseWriter, req *http.Request) { // If sending data through cURL on the commandline and // the content-type header is missed, orr for // applications that aren't explicitly setting Content-Type, - // override to 'application/json' if the body looks like JSON + // override to 'application/json' if the body looks like JSON. if isJSON(reqBody) { req.Header.Set("Content-Type", "application/json") } @@ -360,19 +360,6 @@ func headersToMap(h http.Header) map[string]string { return values } -func headersToMultiMap(h http.Header) map[string][]string { - values := map[string][]string{} - for name, headers := range h { - if len(headers) < 2 { - continue - } - - values[name] = headers - } - - return values -} - func valueToString(f interface{}) (string, bool) { var v string typeof := reflect.TypeOf(f) @@ -459,7 +446,7 @@ func valuesToMultiMap(i url.Values) map[string][]string { return values } -// Check if a string looks like JSON +// Check if a string looks like JSON. func isJSON(s string) bool { var js interface{} return json.Unmarshal([]byte(s), &js) == nil