Comparing version 2.1.0 to 2.3.0
18
index.js
@@ -83,3 +83,11 @@ /** | ||
bodyPromise = bodyPromise || Promise.resolve({}); | ||
return bodyPromise.then(function(body) { | ||
return bodyPromise.catch(function(parsingError) { | ||
if (typeof opts.onError === 'function') { | ||
opts.onError(parsingError, ctx); | ||
} else { | ||
throw parsingError; | ||
} | ||
return next(); | ||
}) | ||
.then(function(body) { | ||
if (opts.patchNode) { | ||
@@ -93,10 +101,2 @@ ctx.req.body = body; | ||
}) | ||
.catch(function(parsingError) { | ||
if (typeof opts.onError === 'function') { | ||
opts.onError(parsingError, ctx); | ||
} else { | ||
throw parsingError; | ||
} | ||
return next(); | ||
}) | ||
}; | ||
@@ -103,0 +103,0 @@ } |
{ | ||
"name": "koa-body", | ||
"version": "2.1.0", | ||
"version": "2.3.0", | ||
"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