File tree Expand file tree Collapse file tree 4 files changed +17
-2
lines changed
Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,11 @@ let package = Package(
1010 ] ,
1111 dependencies: [
1212 // For local development (default)
13- . package ( name: " swift-aws-lambda-runtime " , path: " ../.. " )
13+ . package ( name: " swift-aws-lambda-runtime " , path: " ../.. " ) ,
1414
1515 // For standalone usage, comment the line above and uncomment below:
1616 // .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "1.0.0"),
17+ . package ( url: " https://github.com/awslabs/swift-aws-lambda-events.git " , from: " 1.0.0 " ) ,
1718 ] ,
1819 targets: [
1920 . executableTarget(
Original file line number Diff line number Diff line change 1313//
1414//===----------------------------------------------------------------------===//
1515
16+ import AWSLambdaEvents
1617import AWSLambdaRuntime
1718import NIOCore
1819
@@ -29,6 +30,11 @@ struct SendNumbersWithPause: StreamingLambdaHandler {
2930 context: LambdaContext
3031 ) async throws {
3132
33+ // the payload here is an API Gateway V1 request
34+ // Check the body of the request to extract the business event
35+ let payload = try JSONDecoder ( ) . decode ( APIGatewayRequest . self, from: Data ( event. readableBytesView) )
36+ let _ = payload. body
37+
3238 // Send HTTP status code and headers before streaming the response body
3339 try await responseWriter. writeStatusAndHeaders (
3440 StreamingLambdaStatusAndHeadersResponse (
Original file line number Diff line number Diff line change @@ -10,10 +10,12 @@ let package = Package(
1010 ] ,
1111 dependencies: [
1212 // For local development (default)
13- . package ( name: " swift-aws-lambda-runtime " , path: " ../.. " )
13+ . package ( name: " swift-aws-lambda-runtime " , path: " ../.. " ) ,
1414
1515 // For standalone usage, comment the line above and uncomment below:
1616 // .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "1.0.0"),
17+
18+ . package ( url: " https://github.com/awslabs/swift-aws-lambda-events.git " , from: " 1.0.0 " ) ,
1719 ] ,
1820 targets: [
1921 . executableTarget(
Original file line number Diff line number Diff line change 1313//
1414//===----------------------------------------------------------------------===//
1515
16+ import AWSLambdaEvents
1617import AWSLambdaRuntime
1718import NIOCore
1819
@@ -29,6 +30,11 @@ struct SendNumbersWithPause: StreamingLambdaHandler {
2930 context: LambdaContext
3031 ) async throws {
3132
33+ // The payload here is a FunctionURLRequest.
34+ // Check the body parameters for the business event
35+ let payload = try JSONDecoder ( ) . decode ( FunctionURLRequest . self, from: Data ( event. readableBytesView) )
36+ let _ = payload. body
37+
3238 // Send HTTP status code and headers before streaming the response body
3339 try await responseWriter. writeStatusAndHeaders (
3440 StreamingLambdaStatusAndHeadersResponse (
You can’t perform that action at this time.
0 commit comments