Created
June 10, 2023 09:40
-
-
Save rictorres/06c7dd8497c9a62d8a0eebcf7948e962 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simplest Lambda URL test | |
package main | |
import ( | |
"context" | |
"fmt" | |
"github.com/aws/aws-lambda-go/events" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
func handleRequest(ctx context.Context, request events.LambdaFunctionURLRequest) (events.LambdaFunctionURLResponse, error) { | |
fmt.Printf("Processing request data for request %s.\n", request.RequestContext.RequestID) | |
fmt.Printf("Body size = %d.\n", len(request.Body)) | |
fmt.Println("Headers:") | |
for key, value := range request.Headers { | |
fmt.Printf(" %s: %s\n", key, value) | |
} | |
return events.LambdaFunctionURLResponse{StatusCode: 204}, nil | |
} | |
func main() { | |
lambda.Start(handleRequest) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment