Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

restify

Package Overview
Dependencies
Maintainers
1
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restify - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

2

package.json

@@ -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();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc