0.1.0 • Published 4 years ago

koa-fail v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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