diff --git a/Examples/APIGateway/Sources/main.swift b/Examples/APIGateway/Sources/main.swift index 2d5707d6..f7662d1c 100644 --- a/Examples/APIGateway/Sources/main.swift +++ b/Examples/APIGateway/Sources/main.swift @@ -15,13 +15,6 @@ import AWSLambdaEvents import AWSLambdaRuntime -#if canImport(FoundationEssentials) -import FoundationEssentials -#else -import Foundation -#endif - -let encoder = JSONEncoder() let runtime = LambdaRuntime { (event: APIGatewayV2Request, context: LambdaContext) -> APIGatewayV2Response in @@ -31,10 +24,7 @@ let runtime = LambdaRuntime { header["content-type"] = "application/json" // echo the request in the response - let data = try encoder.encode(event) - let response = String(decoding: data, as: Unicode.UTF8.self) - - return APIGatewayV2Response(statusCode: .ok, headers: header, body: response) + return try APIGatewayV2Response(statusCode: .ok, headers: header, encodableBody: event) } try await runtime.run()