0.1.0 • Published 7 years ago
@body/urlencoded v0.1.0
URL-encoded body parser
Parse an URL-encoded body of an incoming HTTP request.
Installation
npm install --save @body/urlencodedUsage
const getUrlencodedBody = require('@body/urlencoded')
// ...
app.post('/v1/users', async (req, res, next) => {
try {
const body = await getUrlencodedBody(req)
// ...
} catch (err) {
return next(err)
}
})
// ...API
getUrlencodedBody(req: Request, options: Options): Promise<any>
Parse the body of the incoming request req. Returns a promise of the parsed body.
Options
inflate (boolean)
When set to true, then bodies with a deflate or gzip content-encoding will be inflated before being parsed.
Defaults to false.
0.1.0
7 years ago