On Api-Gateway i'm trying so set up mapping from 'Method Request' query string to 'integration request' headers to lambda but the mapping never reach the lambda function.
On 'Method Request' > 'URL Query String Parameters' I set it up the name 'customerIdentification'
Then as the documentation says: doc
went to 'Integration Request' > 'HTTP Headers' add a name 'userId' and mapped to 'method.request.querystring.customerIdentification'
package main
import (
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
func handleRequest(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
fmt.Printf("Processing request data for request %s.
", request.RequestContext.RequestID)
fmt.Printf("Body size = %d.
", len(request.Body))
fmt.Println("Headers:")
for key, value := range request.Headers {
fmt.Printf(" %s: %s
", key, value)
}
xxx, err := json.Marshal(request.Headers)
if err != nil {
fmt.Println("*** err *** err *** err *** err *** err ")
fmt.Println(err)
fmt.Println("*** err *** err *** err *** err *** err ")
}
return events.APIGatewayProxyResponse{Body: string(xxx), StatusCode: 200}, nil
}
func main() {
lambda.Start(handleRequest)
}
I expect that on the golang lambda function code I can retrieve the 'userId' from 'request.Headers'.
but it always come empty