Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions Examples/APIGateway/Sources/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()
Loading