File tree 1 file changed +1
-11
lines changed
Examples/APIGateway/Sources
1 file changed +1
-11
lines changed Original file line number Diff line number Diff line change 15
15
import AWSLambdaEvents
16
16
import AWSLambdaRuntime
17
17
18
- #if canImport(FoundationEssentials)
19
- import FoundationEssentials
20
- #else
21
- import Foundation
22
- #endif
23
-
24
- let encoder = JSONEncoder ( )
25
18
let runtime = LambdaRuntime {
26
19
( event: APIGatewayV2Request , context: LambdaContext ) -> APIGatewayV2Response in
27
20
@@ -31,10 +24,7 @@ let runtime = LambdaRuntime {
31
24
header [ " content-type " ] = " application/json "
32
25
33
26
// 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)
38
28
}
39
29
40
30
try await runtime. run ( )
You can’t perform that action at this time.
0 commit comments