Merge alpha 0.0.5 to master #54

Merged
niggl merged 292 commits from dev into main 2020-12-23 17:05:35 +00:00
Showing only changes of commit b9fd2379f4 - Show all commits

View File

@ -0,0 +1,27 @@
import { Request, Response } from 'express';
const RawBodyMiddleware = (req: Request, res: Response, next: () => void) => {
const body = []
req.on('data', chunk => {
body.push(chunk)
})
req.on('end', () => {
const rawBody = Buffer.concat(body)
req['rawBody'] = rawBody
/*
switch (req.header('content-type')) {
case 'application/json':
req.body = JSON.parse(rawBody.toString())
break
// add more body parsing if needs be
default:
}
*/
next()
})
req.on('error', () => {
res.sendStatus(400)
})
}
export default RawBodyMiddleware