Skip to content

Commit

Permalink
Merge pull request #255 from JamesJJ/jj-patch-1
Browse files Browse the repository at this point in the history
Improve Go code example
  • Loading branch information
devlinbd2 authored Mar 19, 2021
2 parents f7e2111 + 0e9f498 commit 2141ea6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions doc_source/services-apigateway-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,19 @@ The following example processes messages from API Gateway, and logs information
**Example LambdaFunctionOverHttps\.go**

```
package main
import (
"strings"
"context"
"fmt"
"github.com/aws/aws-lambda-go/events"
runtime "github.com/aws/aws-lambda-go/lambda"
)
func main() {
runtime.Start(handleRequest)
}
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))
Expand All @@ -133,7 +141,7 @@ func handleRequest(ctx context.Context, request events.APIGatewayProxyRequest) (
fmt.Printf(" %s: %s\n", key, value)
}
return events.APIGatewayProxyResponse { Body: request.Body, StatusCode: 200 }, nil
return events.APIGatewayProxyResponse{Body: request.Body, StatusCode: 200}, nil
}
```

Expand Down

0 comments on commit 2141ea6

Please sign in to comment.