koa-override
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/koa-override package

3.0.0 • Public • Published

koa-override

NPM version build status Test coverage David deps npm download

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

Install

$ npm install koa-override --save

Usage

const bodyParser = require('koa-bodyparser')
const override = require('koa-override')
 
app.use(bodyParser())
app.use(override())

API

const mw = override([options])

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.

License

MIT

/koa-override/

    Package Sidebar

    Install

    npm i koa-override

    Weekly Downloads

    20,411

    Version

    3.0.0

    License

    MIT

    Last publish

    Collaborators

    • dead_horse
    • popomore
    • dead-horse
    • fengmk2