Comparing version 1.1.1 to 1.1.2
14
index.js
@@ -30,12 +30,6 @@ /** | ||
/** | ||
* when request body exist | ||
* Judge conten-type | ||
*/ | ||
if (req.body) { | ||
if (! ~resContentTypes.indexOf('application/vnd.api+json')) { | ||
return next((0, _buildHttpError2['default'])(415)); | ||
} else if (resContentTypes.split(';').length > 1) { | ||
return next((0, _buildHttpError2['default'])(415)); | ||
} | ||
/* When body has data, need to validate content type */ | ||
var contentLength = req.headers['content-length']; | ||
if (contentLength > 0 && resContentTypes !== 'application/vnd.api+json') { | ||
return next((0, _buildHttpError2['default'])(415)); | ||
} | ||
@@ -42,0 +36,0 @@ |
@@ -19,12 +19,6 @@ /** | ||
/** | ||
* when request body exist | ||
* Judge conten-type | ||
*/ | ||
if (req.method === 'POST' || req.method === 'PUT' || req.method === 'PATCH') { | ||
if (!~resContentTypes.indexOf('application/vnd.api+json')) { | ||
return next(httpError(415)) | ||
} else if (resContentTypes.split(';').length > 1) { | ||
return next(httpError(415)) | ||
} | ||
/* When body has data, need to validate content type */ | ||
const contentLength = req.headers['content-length'] | ||
if (contentLength > 0 && resContentTypes !== 'application/vnd.api+json') { | ||
return next(httpError(415)) | ||
} | ||
@@ -31,0 +25,0 @@ |
{ | ||
"name": "njv", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "jsonapi validator middleware for node.js", | ||
@@ -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
6947
97