Skip to content

Commit d4b29a4

Browse files
author
v 1 r t l
authored
Merge pull request #19 from Fei1Yang/fix-raw-text
Fix raw and text parser.
2 parents 6934d19 + 34b8428 commit d4b29a4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/index.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,18 @@ const json = () => async (req: ReqWithBody, res: Response, next: NextFunction) =
4242
}
4343

4444
const raw = () => async (req: ReqWithBody, _res: Response, next: NextFunction) => {
45-
if (hasBody(req.method)) req.body = await p((x) => x)(req, _res, next)
45+
if (hasBody(req.method)) {
46+
req.body = await p((x) => x)(req, _res, next)
47+
next()
48+
}
4649
else next()
4750
}
4851

4952
const text = () => async (req: ReqWithBody, _res: Response, next: NextFunction) => {
50-
if (hasBody(req.method)) req.body = await p((x) => x.toString())(req, _res, next)
53+
if (hasBody(req.method)) {
54+
req.body = await p((x) => x.toString())(req, _res, next)
55+
next()
56+
}
5157
else next()
5258
}
5359

0 commit comments

Comments
 (0)