Comparing version 2.0.1 to 2.0.2
@@ -23,3 +23,3 @@ { | ||
"description": "REST framework", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"repository": { | ||
@@ -26,0 +26,0 @@ "type": "git", |
@@ -305,2 +305,29 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved. | ||
test('GH-279 more JSON Arrays', function (t) { | ||
function respond(req, res, next) { | ||
t.ok(Array.isArray(req.params)); | ||
t.equal(req.params[0].id, '123654'); | ||
t.ok(req.params[0].name, 'mimi'); | ||
t.ok(req.params[1].id, '987654'); | ||
t.ok(req.params[1].name, 'pijama'); | ||
res.send(200); | ||
next(); | ||
} | ||
SERVER.post('/gh279', restify.jsonBodyParser(), respond); | ||
var obj = [ { | ||
'id': '123654', | ||
'name': 'mimi' | ||
}, { | ||
id: '987654', | ||
name: 'pijama' | ||
}]; | ||
CLIENT.post('/gh279', obj, function (err, _, res) { | ||
t.ifError(err); | ||
t.end(); | ||
t.equal(res.statusCode, 200); | ||
}); | ||
}); | ||
test('date expired', function (t) { | ||
@@ -307,0 +334,0 @@ var opts = { |
@@ -902,1 +902,85 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved. | ||
}); | ||
test('gh-278 missing router error events (404)', function (t) { | ||
SERVER.once('NotFound', function (req, res) { | ||
res.send(404, 'foo'); | ||
}); | ||
CLIENT.get('/' + uuid.v4(), function (err, _, res) { | ||
t.ok(err); | ||
t.equal(err.message, '"foo"'); | ||
t.equal(res.statusCode, 404); | ||
t.end(); | ||
}); | ||
}); | ||
test('gh-278 missing router error events (405)', function (t) { | ||
var p = '/' + uuid.v4(); | ||
SERVER.post(p, function (req, res, next) { | ||
res.send(201); | ||
next(); | ||
}); | ||
SERVER.once('MethodNotAllowed', function (req, res) { | ||
res.send(405, 'foo'); | ||
}); | ||
CLIENT.get(p, function (err, _, res) { | ||
t.ok(err); | ||
t.equal(err.message, '"foo"'); | ||
t.equal(res.statusCode, 405); | ||
t.end(); | ||
}); | ||
}); | ||
test('gh-278 missing router error events invalid version', function (t) { | ||
var p = '/' + uuid.v4(); | ||
SERVER.get({ | ||
path: p, | ||
version: '1.2.3' | ||
}, function (req, res, next) { | ||
res.send(200); | ||
next(); | ||
}); | ||
SERVER.once('VersionNotAllowed', function (req, res) { | ||
res.send(449, 'foo'); | ||
}); | ||
var opts = { | ||
path: p, | ||
headers: { | ||
'accept-version': '3.2.1' | ||
} | ||
}; | ||
CLIENT.get(opts, function (err, _, res) { | ||
t.ok(err); | ||
t.equal(err.message, '"foo"'); | ||
t.equal(res.statusCode, 449); | ||
t.end(); | ||
}); | ||
}); | ||
test('gh-278 missing router error events (415)', function (t) { | ||
var p = '/' + uuid.v4(); | ||
SERVER.post({ | ||
path: p, | ||
contentType: 'text/xml' | ||
}, function (req, res, next) { | ||
res.send(200); | ||
next(); | ||
}); | ||
SERVER.once('UnsupportedMediaType', function (req, res) { | ||
res.send(415, 'foo'); | ||
}); | ||
CLIENT.post(p, {}, function (err, _, res) { | ||
t.ok(err); | ||
t.equal(err.message, '"foo"'); | ||
t.equal(res.statusCode, 415); | ||
t.end(); | ||
}); | ||
}); |
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
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
7
4
78458
11
2040