File tree Expand file tree Collapse file tree 1 file changed +1
-11
lines changed
Examples/APIGateway/Sources Expand file tree Collapse file tree 1 file changed +1
-11
lines changed Original file line number Diff line number Diff line change 1515import AWSLambdaEvents
1616import AWSLambdaRuntime
1717
18- #if canImport(FoundationEssentials)
19- import FoundationEssentials
20- #else
21- import Foundation
22- #endif
23-
24- let encoder = JSONEncoder ( )
2518let runtime = LambdaRuntime {
2619 ( event: APIGatewayV2Request , context: LambdaContext ) -> APIGatewayV2Response in
2720
@@ -31,10 +24,7 @@ let runtime = LambdaRuntime {
3124 header [ " content-type " ] = " application/json "
3225
3326 // echo the request in the response
34- let data = try encoder. encode ( event)
35- let response = String ( decoding: data, as: Unicode . UTF8. self)
36-
37- return APIGatewayV2Response ( statusCode: . ok, headers: header, body: response)
27+ return try APIGatewayV2Response ( statusCode: . ok, headers: header, encodableBody: event)
3828}
3929
4030try await runtime. run ( )
You can’t perform that action at this time.
0 commit comments