Skip to content

Commit

Permalink
Merge 34b8428 into 6934d19
Browse files Browse the repository at this point in the history
  • Loading branch information
Fei1Yang committed May 10, 2022
2 parents 6934d19 + 34b8428 commit 3a76bcd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/index.ts
Expand Up @@ -42,12 +42,18 @@ const json = () => async (req: ReqWithBody, res: Response, next: NextFunction) =
}

const raw = () => async (req: ReqWithBody, _res: Response, next: NextFunction) => {
if (hasBody(req.method)) req.body = await p((x) => x)(req, _res, next)
if (hasBody(req.method)) {
req.body = await p((x) => x)(req, _res, next)
next()
}
else next()
}

const text = () => async (req: ReqWithBody, _res: Response, next: NextFunction) => {
if (hasBody(req.method)) req.body = await p((x) => x.toString())(req, _res, next)
if (hasBody(req.method)) {
req.body = await p((x) => x.toString())(req, _res, next)
next()
}
else next()
}

Expand Down

0 comments on commit 3a76bcd

Please sign in to comment.