|
1 год назад | |
---|---|---|
.. | ||
History.md | 1 год назад | |
LICENSE | 1 год назад | |
README.md | 1 год назад | |
index.js | 1 год назад | |
package.json | 1 год назад |
Method override middleware. Let you use HTTP verbs such as PUT or DELETE in places where the client doesn't support it.
Refactor from koa-override-method#5
$ npm install koa-override --save
const bodyParser = require('koa-bodyparser')
const override = require('koa-override')
app.use(bodyParser())
app.use(override())
If body
exists, check body._method
first.
Otherwise check X-HTTP-Method-Override
header.
If there is no override parameter, then it's simply this.request.method
.
You shouldn't use this unless you know you're using override.
options.allowedMethods = [ 'POST' ]
Only allowed override method on POST
request.