Skip to content

Instantly share code, notes, and snippets.

@rictorres
Created June 10, 2023 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rictorres/06c7dd8497c9a62d8a0eebcf7948e962 to your computer and use it in GitHub Desktop.
Save rictorres/06c7dd8497c9a62d8a0eebcf7948e962 to your computer and use it in GitHub Desktop.
// 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