Comparing version 1.0.0 to 1.0.1
21
index.js
@@ -44,11 +44,16 @@ /** | ||
var body = {}; | ||
if (this.is('json')) { | ||
body = yield buddy.json(this, {encoding: opts.encoding, limit: opts.jsonLimit}); | ||
// GET, HEAD, and DELETE requests have no defined semantics for the request body | ||
// (http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-19#section-6.3) | ||
// so don't parse the body in those cases. | ||
if (["GET", "HEAD", "DELETE"].indexOf(this.method.toUpperCase()) === -1) { | ||
if (this.is('json')) { | ||
body = yield buddy.json(this, {encoding: opts.encoding, limit: opts.jsonLimit}); | ||
} | ||
else if (this.is('urlencoded')) { | ||
body = yield buddy.form(this, {encoding: opts.encoding, limit: opts.formLimit}); | ||
} | ||
else if (opts.multipart && this.is('multipart')) { | ||
body = yield formy(this, opts.formidable); | ||
} | ||
} | ||
else if (this.is('urlencoded')) { | ||
body = yield buddy.form(this, {encoding: opts.encoding, limit: opts.formLimit}); | ||
} | ||
else if (opts.multipart && this.is('multipart')) { | ||
body = yield formy(this, opts.formidable); | ||
} | ||
@@ -55,0 +60,0 @@ if (opts.patchNode) { |
{ | ||
"name": "koa-body", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A koa body parser middleware. Support multipart, urlencoded and json request bodies.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
9615
96