koa-json-body
Advanced tools
Comparing version
18
index.js
'use strict'; | ||
var coBody = require('co-body'); | ||
var parse = require('co-body'); | ||
var initialize = function(opts) { | ||
opts = opts || {}; | ||
opts = opts || { strict: true }; | ||
return function *(next) { | ||
this.request.body = {}; | ||
this.request.body = yield parse.json(this, opts); | ||
this.body = this.request.body; | ||
try { | ||
if (this.is('application/json')) { | ||
this.request.body = yield coBody.json(this, opts); | ||
} | ||
} catch(e) { | ||
} | ||
yield next; | ||
} | ||
} | ||
}; | ||
}; | ||
module.exports = initialize; |
{ | ||
"name": "koa-json-body", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"description": "koa middleware to parse json request bodies", | ||
@@ -27,4 +27,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"co-body": "^0.0.1" | ||
"co-body": "^2.0.0" | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
-50%2027
-3.15%11
-31.25%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated