# koa-override

> method override middleware for koa

Latest version **4.0.0** (published 2024-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-override
pnpm add koa-override
yarn add koa-override
bun add koa-override
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2024-06-23 |
| First published | 2015-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 18.19.0 |
| Dependencies | 0 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 7 |
| Author | fengmk2 |
| Keywords | koa-override, override-method, method-override, override, rewrite |

## Links

- npm: https://www.npmjs.com/package/koa-override
- Repository: https://github.com/eggjs/koa-override
- Issues: https://github.com/eggjs/koa-override/issues
- npm.io page: https://npm.io/package/koa-override

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2024-06-23
- 3.0.0 — 2017-11-08
- 2.0.0 — 2017-06-19
- 1.0.0 — 2015-02-09

## README

# koa-override

[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]
[![CI](https://github.com/eggjs/koa-override/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/koa-override/actions?query=branch%3Amaster)
[![Coverage](https://img.shields.io/codecov/c/github/eggjs/koa-override.svg?style=flat-square)](https://codecov.io/gh/eggjs/koa-override)

[npm-image]: https://img.shields.io/npm/v/koa-override.svg?style=flat-square
[npm-url]: https://npmjs.org/package/koa-override
[download-image]: https://img.shields.io/npm/dm/koa-override.svg?style=flat-square
[download-url]: https://npmjs.org/package/koa-override

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](https://github.com/koajs/override-method/pull/5)

## Install

```bash
npm install koa-override --save
```

## Usage

```ts
import bodyParser from 'koa-bodyparser';
import override from '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](LICENSE)

## Contributors

[![Contributors](https://contrib.rocks/image?repo=eggjs/koa-override)](https://github.com/eggjs/koa-override/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).

---
_Source: https://npm.io/package/koa-override · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
