Skip to content

Commit 3617120

Browse files
committed
update APIGateway example with the new APIGatewayResponse initializer
1 parent 25eb6e1 commit 3617120

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Examples/APIGateway/Sources/main.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ let runtime = LambdaRuntime {
3131
header["content-type"] = "application/json"
3232

3333
// 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)
34+
return try APIGatewayV2Response(statusCode: .ok, headers: header, encodableBody: event)
3835
}
3936

4037
try await runtime.run()

0 commit comments

Comments
 (0)