Comparing version 0.0.3 to 0.0.4
11
index.js
'use strict'; | ||
var co_body = require('co-body'); | ||
module.exports = function(opts){ | ||
var patchNode = (opts && opts.patchNode) || false; | ||
var patchKoa = (opts && opts.patchKoa) || true; | ||
var patchNode = (opts && 'patchNode' in opts) ? opts.patchNode : false; | ||
var patchKoa = (opts && 'patchKoa' in opts) ? opts.patchKoa : true; | ||
return function *(next){ | ||
var body; | ||
if(this.is('application/json')){ | ||
var body = yield co_body.json(this); | ||
body = yield co_body.json(this); | ||
if(patchNode){ | ||
@@ -20,3 +19,3 @@ this.req.body = body; | ||
else if(this.is('application/x-www-form-urlencoded')){ | ||
var body = yield co_body.form(this); | ||
body = yield co_body.form(this); | ||
if(patchNode){ | ||
@@ -23,0 +22,0 @@ this.req.body = body; |
{ | ||
"name": "koa-body", | ||
"version": "0.0.3", | ||
"description": "Simple wrapper around co-body for koa", | ||
"version": "0.0.4", | ||
"description": "koa middleware that parses request body", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2101
28