Skip to content

Change to working sample code #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions events/README_ApiGatewayEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,29 @@ The following is a sample class and Lambda function that receives Amazon API Gat

```go

package main

import (
"strings"
"github.com/aws/aws-lambda-go/events"
"context"
"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 {
fmt.Printf("Processing request data for request %s.\n", request.RequestContext.RequestId)
fmt.Printf("Body size = %d.\n", len(request.Body))
func handleRequest(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, 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)
}
fmt.Println("Headers:")
for key, value := range request.Headers {
fmt.Printf(" %s: %s\n", key, value)
}

return events.APIGatewayProxyResponse{Body: request.Body, StatusCode: 200}, nil
}

return ApiGatewayProxyResponse { Body: request.Body, StatusCode: 200 }
func main() {
lambda.Start(handleRequest)
}
```