use koa-is-json
This commit is contained in:
parent
94dd87741e
commit
0cacc5706a
3 changed files with 4 additions and 13 deletions
|
@ -3,6 +3,7 @@ HEAD /
|
||||||
==================
|
==================
|
||||||
|
|
||||||
* refactor mime with mime-extended
|
* refactor mime with mime-extended
|
||||||
|
* refactor to use koa-is-json
|
||||||
|
|
||||||
0.5.5 / 2014-04-14
|
0.5.5 / 2014-04-14
|
||||||
==================
|
==================
|
||||||
|
|
|
@ -10,6 +10,7 @@ var compose = require('koa-compose');
|
||||||
var context = require('./context');
|
var context = require('./context');
|
||||||
var request = require('./request');
|
var request = require('./request');
|
||||||
var response = require('./response');
|
var response = require('./response');
|
||||||
|
var isJSON = require('koa-is-json');
|
||||||
var Cookies = require('cookies');
|
var Cookies = require('cookies');
|
||||||
var accepts = require('accepts');
|
var accepts = require('accepts');
|
||||||
var status = require('statuses');
|
var status = require('statuses');
|
||||||
|
@ -207,15 +208,3 @@ function *respond(next) {
|
||||||
this.length = Buffer.byteLength(body);
|
this.length = Buffer.byteLength(body);
|
||||||
res.end(body);
|
res.end(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if `body` should be interpreted as json.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function isJSON(body) {
|
|
||||||
if (!body) return false;
|
|
||||||
if ('string' == typeof body) return false;
|
|
||||||
if (body instanceof Stream) return false;
|
|
||||||
if (Buffer.isBuffer(body)) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
"mime-extended": "^1.0.0",
|
"mime-extended": "^1.0.0",
|
||||||
"fresh": "~0.2.1",
|
"fresh": "~0.2.1",
|
||||||
"koa-compose": "~2.2.0",
|
"koa-compose": "~2.2.0",
|
||||||
|
"koa-is-json": "~1.0.0",
|
||||||
"cookies": "~0.4.0",
|
"cookies": "~0.4.0",
|
||||||
"delegates": "0.0.3",
|
"delegates": "0.0.3",
|
||||||
"dethroy": "~1.0.0",
|
"dethroy": "~1.0.0",
|
||||||
|
|
Loading…
Reference in a new issue