koa-fail

0.1.0 • Public • Published

koa-fail

Koa middleware which can be configured to fail and increase latency at random.

Usage

const Koa = require('koa')
const fail = require('koa-fail')

const app = new Koa()

app.use(fail(options))

Options

Options can be setup during initialization , or in query string of every incoming request.

maxDelay

Type: Number

Default: 2000

Max delay in milliseconds. Example of 200ms: ?maxDelay=200.

errorRate

Type: Number

Default: 3

Error rate. Example of 1/3 failures: ?errorRate=3.

force

Type: Boolean

Force to enable failure. By default, it is enabled only in the development environment by process.env.NODE_ENV === 'development'.


sqrtthree.com  ·  GitHub @sqrthree  ·  Twitter @sqrtthree

Readme

Keywords

none

Package Sidebar

Install

npm i koa-fail

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

4.49 kB

Total Files

5

Last publish

Collaborators

  • sqrtthree