File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -82,19 +82,21 @@ public struct StreamingLambdaCodableAdapter<
82
82
context: LambdaContext
83
83
) async throws {
84
84
85
- // try to decode the event as a FunctionURLRequest and extract it's body
85
+ // try to decode the event as a FunctionURLRequest and extract its body
86
86
let urlRequestBody = bodyFromFunctionURLRequest ( event)
87
87
88
- // otherwise, decode the event as a user-provided JSON event
88
+ // decode the body or the event as user-provided JSON
89
89
let decodedEvent = try self . decoder. decode ( Handler . Event. self, from: urlRequestBody ?? event)
90
+
91
+ // and pass it to the handler
90
92
try await self . handler. handle ( decodedEvent, responseWriter: responseWriter, context: context)
91
93
}
92
94
93
- /// Extract the body payload from the event.
95
+ /// Extract the body payload from a FunctionURLRequest event.
94
96
/// This function checks if the event is a valid `FunctionURLRequest` and decodes the body if it is base64 encoded.
95
97
/// If the event is not a valid `FunctionURLRequest`, it returns nil.
96
98
/// - Parameter event: The raw ByteBuffer event to check.
97
- /// - Returns: the base64 decodeded body of the FunctionURLRequest if it is a valid FunctionURLRequest, otherwise nil.
99
+ /// - Returns: The base64 decoded body of the FunctionURLRequest if it is a valid FunctionURLRequest, otherwise nil.
98
100
@inlinable
99
101
package func bodyFromFunctionURLRequest( _ event: ByteBuffer ) -> ByteBuffer ? {
100
102
do {
You can’t perform that action at this time.
0 commit comments