toa-body
Request body parser for toa.
toa
Demo
const Toa = const toaBody = const app = appapp
const Toa = const toaBody = const app = app // It will try to parse body for every request. appapp
Installation
npm install toa-body
API
const toaBody =
toaBody(app[, options])
It will add parseBody
method to context
.
options.encoding
: requested encoding. Default isutf8
.options.formLimit
: limit of theurlencoded
body. If the body ends up being larger than this limit, a 413 error code is returned. Default is56kb
options.jsonLimit
: limit of thejson
body. Default is1mb
options.extendTypes
: support extend types:
)
options.parse
: support custom parse:
const parseXml = parseString )
context.parseBody()
return thunk function.
thisbody = this
this { // this.request.body === body thisbody = body}
app.use(toaBody([options]))
Toa >= v2.x required.
Licences
(The MIT License)