Comparing version
@@ -8,3 +8,3 @@ | ||
app.get('/user', function(req, res){ | ||
res.send(201, { name: 'tobi' }); | ||
res.status(201).json({ name: 'tobi' }); | ||
}); | ||
@@ -15,3 +15,3 @@ | ||
.expect('Content-Type', /json/) | ||
.expect('Content-Length', '20') | ||
.expect('Content-Length', '15') | ||
.expect(201) | ||
@@ -18,0 +18,0 @@ .end(function(err, res){ |
@@ -0,1 +1,9 @@ | ||
1.2.0 / 2016-02-11 | ||
=================== | ||
* PR-302 - Update to superagent ^1.7.2 | ||
* PR-313 - Update node versions on Travis CI | ||
* PR-223 - Remove Makefile for running tests | ||
* PR-286 - Fix bug with redirects | ||
1.1.0 / 2015-08-26 | ||
@@ -2,0 +10,0 @@ =================== |
@@ -122,3 +122,3 @@ /** | ||
end.call(this, function(err, res){ | ||
if (server) return server.close(assert); | ||
if (server && server._handle) return server.close(assert); | ||
@@ -272,2 +272,1 @@ assert(); | ||
} | ||
{ | ||
"name": "supertest", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Super-agent driven library for testing HTTP servers", | ||
@@ -8,17 +8,17 @@ "main": "index.js", | ||
"pretest": "npm install", | ||
"test": "make test" | ||
"test": "mocha --require should --reporter spec --check-leaks" | ||
}, | ||
"dependencies": { | ||
"superagent": "~1.3.0", | ||
"superagent": "^1.7.2", | ||
"methods": "1.x" | ||
}, | ||
"devDependencies": { | ||
"body-parser": "~1.13.2", | ||
"cookie-parser": "~1.3.5", | ||
"express": "~4.12.4", | ||
"mocha": "~2.2.5", | ||
"should": "~7.0.2", | ||
"body-parser": "~1.13.2", | ||
"cookie-parser": "~1.3.5" | ||
"should": "~7.0.2" | ||
}, | ||
"engines": { | ||
"node": ">=0.8.0" | ||
"node": ">=0.10.0" | ||
}, | ||
@@ -25,0 +25,0 @@ "keywords": [ |
@@ -35,3 +35,3 @@ # SuperTest [](https://travis-ci.org/visionmedia/supertest) [](https://www.npmjs.com/package/supertest) | ||
app.get('/user', function(req, res){ | ||
res.send(200, { name: 'tobi' }); | ||
res.status(200).json({ name: 'tobi' }); | ||
}); | ||
@@ -42,3 +42,3 @@ | ||
.expect('Content-Type', /json/) | ||
.expect('Content-Length', '20') | ||
.expect('Content-Length', '15') | ||
.expect(200) | ||
@@ -45,0 +45,0 @@ .end(function(err, res){ |
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; | ||
var request = require('..') | ||
@@ -162,2 +164,24 @@ , https = require('https') | ||
it('should handle redirects', function(done){ | ||
var app = express(); | ||
app.get('/login', function (req, res){ | ||
res.end('Login') | ||
}); | ||
app.get('/', function(req, res){ | ||
res.redirect('/login'); | ||
}); | ||
request(app) | ||
.get('/') | ||
.redirects(1) | ||
.end(function (err, res) { | ||
should.exist(res) | ||
res.status.should.be.equal(200) | ||
res.text.should.be.equal('Login') | ||
done() | ||
}) | ||
}); | ||
it('should handle socket errors', function(done) { | ||
@@ -274,2 +298,42 @@ var app = express(); | ||
}); | ||
it('should handle an undefined Response', function (done) { | ||
var app = express(); | ||
app.get('/', function(req, res){ | ||
setTimeout( function () { | ||
res.end(); | ||
}, 20); | ||
}); | ||
var s = app.listen(function(){ | ||
var url = 'http://localhost:' + s.address().port; | ||
request(url) | ||
.get('/') | ||
.timeout(1) | ||
.expect(200, function (err) { | ||
err.should.be.an.instanceof(Error); | ||
return done(); | ||
}); | ||
}); | ||
}); | ||
it('should handle error returned when server goes down', function (done) { | ||
var app = express(); | ||
app.get('/', function(req, res){ | ||
res.end(); | ||
}); | ||
var s = app.listen(function(){ | ||
var url = 'http://localhost:' + s.address().port; | ||
s.close(); | ||
request(url) | ||
.get('/') | ||
.expect(200, function (err) { | ||
err.should.be.an.instanceof(Error); | ||
return done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -792,3 +856,3 @@ | ||
app.get('/', function(req, res) { | ||
res.send(500, {message: 'something went wrong'}); | ||
res.status(500).json({message: 'something went wrong'}); | ||
}); | ||
@@ -812,3 +876,3 @@ | ||
app.get('/', function(req, res) { | ||
res.send(500, {message: 'something went wrong'}); | ||
res.status(500).json({message: 'something went wrong'}); | ||
}); | ||
@@ -815,0 +879,0 @@ |
Sorry, the diff of this file is not supported yet
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
47163
3.55%1201
4.62%13
-7.14%2
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated