larvituser-api
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -41,2 +41,10 @@ 'use strict'; | ||
that.api.middleware.splice(1, 0, function (req, res, cb) { | ||
if (req.method.toUpperCase() !== 'GET' && req.rawBody === undefined) { | ||
res.statusCode = 400; | ||
res.end('"Bad Request\nNo body provided"'); | ||
log.verbose(logPrefix + 'No body provided.'); | ||
return; | ||
} | ||
if (req.rawBody) { | ||
@@ -43,0 +51,0 @@ try { |
{ | ||
"name": "larvituser-api", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "REST api built on top of larvituser", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -360,2 +360,18 @@ 'use strict'; | ||
test('PUT without body', function (t) { | ||
const reqOptions = {}; | ||
reqOptions.url = 'http://localhost:' + UserApi.instance.api.lBase.httpServer.address().port + '/user'; | ||
reqOptions.method = 'PUT'; | ||
reqOptions.json = true; | ||
request(reqOptions, function (err, response, body) { | ||
if (err) return cb(err); | ||
t.equal(response.statusCode, 400); | ||
console.log(body); | ||
t.end(); | ||
}); | ||
}); | ||
test('GET user, malformed statements', function (t) { | ||
@@ -362,0 +378,0 @@ const tasks = []; |
@@ -31,2 +31,3 @@ 'use strict'; | ||
reqOptions.json = true; | ||
reqOptions.body = {}; | ||
@@ -33,0 +34,0 @@ request(reqOptions, function (err, response, body) { |
@@ -78,2 +78,4 @@ 'use strict'; | ||
reqOptions.method = 'DELETE'; | ||
reqOptions.json = true; | ||
reqOptions.body = {}; | ||
@@ -80,0 +82,0 @@ request(reqOptions, function (err, response) { |
@@ -379,5 +379,7 @@ 'use strict'; | ||
reqOptions.method = 'POST'; | ||
reqOptions.body = { 'asdfa': 'asdfa' }; | ||
reqOptions.json = true; | ||
request(reqOptions, function (err, response) { | ||
if (err) return cb(err); | ||
if (err) throw err; | ||
@@ -384,0 +386,0 @@ t.equal(response.statusCode, 405); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
82632
2212
1