koa-saccept
Semantic HTTP accept middleware for koajs
Installation
$ npm install koa-saccept
Usage
var saccept = require('koa-saccept');
var app = require('express')();
app.use(saccept());
app.get('/', function * () {
// accept: application/vnd.xxx.v1.6.0+json will be accepted here
// accept: application/vnd.xxx.v1.6.0+xml will be rejected here
// accept: application/vnd.xxx.v1.5.0+json will be rejected here
this.request.accept('1.6.*', 'application/json');
});
Ref
License
MIT