File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
packages/parser/src/envelopes Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ export class ApiGatewayEnvelope extends Envelope {
14
14
public parse < T extends ZodSchema > ( data : unknown , schema : T ) : z . infer < T > {
15
15
const parsedEnvelope : ApiGatewayProxyEvent =
16
16
APIGatewayProxyEventSchema . parse ( data ) ;
17
- if ( parsedEnvelope . body === undefined ) {
17
+ if ( parsedEnvelope . body ) {
18
+ return this . _parse ( parsedEnvelope . body , schema ) ;
19
+ } else {
18
20
throw new Error ( 'Body field of API Gateway event is undefined' ) ;
19
21
}
20
-
21
- return this . _parse ( parsedEnvelope . body , schema ) ;
22
22
}
23
23
}
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ export class ApiGatwayV2Envelope extends Envelope {
12
12
13
13
public parse < T extends ZodSchema > ( data : unknown , schema : T ) : z . infer < T > {
14
14
const parsedEnvelope = APIGatewayProxyEventV2Schema . parse ( data ) ;
15
- if ( parsedEnvelope . body === undefined ) {
15
+ if ( parsedEnvelope . body ) {
16
+ return this . _parse ( parsedEnvelope . body , schema ) ;
17
+ } else {
16
18
throw new Error ( 'Body field of API Gateway V2 event is undefined' ) ;
17
19
}
18
-
19
- return this . _parse ( parsedEnvelope . body , schema ) ;
20
20
}
21
21
}
You can’t perform that action at this time.
0 commit comments