File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Examples/Streaming+Codable/Sources Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -90,11 +90,17 @@ public struct StreamingLambdaCodableAdapter<
9090
9191 var decodedBody : Handler . Event !
9292
93+ // Try to decode the event. It first tries FunctionURLRequest, then APIGatewayRequest, then "as-is"
94+
9395 // try to decode the event as a FunctionURLRequest, then fetch its body attribute
9496 if let request = try ? self . decoder. decode ( FunctionURLRequest . self, from: event) {
9597 // decode the body as user-provided JSON type
9698 // this function handles the base64 decoding when needed
9799 decodedBody = try request. decodeBody ( Handler . Event. self)
100+ } else if let request = try ? self . decoder. decode ( APIGatewayRequest . self, from: event) {
101+ // decode the body as user-provided JSON type
102+ // this function handles the base64 decoding when needed
103+ decodedBody = try request. decodeBody ( Handler . Event. self)
98104 } else {
99105 // try to decode the event "as-is" with the provided JSON type
100106 decodedBody = try self . decoder. decode ( Handler . Event. self, from: event)
You can’t perform that action at this time.
0 commit comments