0.1.5 • Published 10 years ago

koa-httpany v0.1.5

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

koa-httpany

koa middleware that make your app response with arbitrary http status and headers, based on query string. Only support koa v2.x

Travis Coveralls branch npm

Installation

$ npm install koa-httpany

Example

'use strict'
var Koa = require('koa')
var httpAny = require('.')
var app = new Koa()
app.use(httpAny.anyStatus)
app.use(httpAny.anyHeader)
app.use((ctx, next) => {
  ctx.body = JSON.stringify(ctx, null, 2)
  return next()
})
app.listen(3000)
console.log('open http://localhost:3000/?status=201&foo=bar&answer=42 to see result')

You can see that response http status is 201, and headers contains "foo: bar" and "answer: 42".

WARNING

Don't use this middleware in production environment for safety considerations.

License

MIT © flowmemo

0.2.5

10 years ago

0.2.4

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago