Deps updates

This commit is contained in:
Dobie Wollert
2015-11-24 22:12:24 -08:00
parent 974014ab44
commit f5bc55b1f5
504 changed files with 69316 additions and 15 deletions

77
node_modules/cors/test/error-response.js generated vendored Normal file
View File

@ -0,0 +1,77 @@
(function () {
/*global describe, it*/
'use strict';
var should = require('should'),
express = require('express'),
supertest = require('supertest'),
cors = require('../lib');
var app;
/* -------------------------------------------------------------------------- */
app = express();
app.use(cors());
app.post('/five-hundred', function (req, res, next) {
next(new Error('nope'));
});
app.post('/four-oh-one', function (req, res, next) {
next(new Error('401'));
});
app.post('/four-oh-four', function (req, res, next) {
next();
});
app.use(function (err, req, res, next) {
if (err.message === '401') {
res.status(401).send('unauthorized');
} else {
next(err);
}
});
/* -------------------------------------------------------------------------- */
describe('error response', function () {
it('500', function (done) {
supertest(app)
.post('/five-hundred')
.expect(500)
.end(function (err, res) {
should.not.exist(err);
res.headers['access-control-allow-origin'].should.eql('*');
res.text.should.startWith('Error: nope');
done();
});
});
it('401', function (done) {
supertest(app)
.post('/four-oh-one')
.expect(401)
.end(function (err, res) {
should.not.exist(err);
res.headers['access-control-allow-origin'].should.eql('*');
res.text.should.eql('unauthorized');
done();
});
});
it('404', function (done) {
supertest(app)
.post('/four-oh-four')
.expect(404)
.end(function (err, res) {
should.not.exist(err);
res.headers['access-control-allow-origin'].should.eql('*');
done();
});
});
});
}());