Skip to content

Commit 8aa7cb0

Browse files
authored
fix(api): bodySchema malformed on request without body (#20)
1 parent 755ca96 commit 8aa7cb0

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/api/src/lib/middleware/middyfy.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,11 @@ export const middyfy = ({
153153
ajvOptions,
154154
});
155155

156-
let middyfiedHandler = middy(handler)
157-
.use(doNotWaitForEmptyEventLoop())
158-
.use(middyJsonBodyParser());
156+
let middyfiedHandler = middy(handler).use(doNotWaitForEmptyEventLoop());
157+
158+
if (bodySchema) {
159+
middyfiedHandler = middyfiedHandler.use(middyJsonBodyParser());
160+
}
159161

160162
if (inputValidate || outputValidate) {
161163
middyfiedHandler = middyfiedHandler.use(

0 commit comments

Comments
 (0)