Comparing version 1.1.0 to 1.2.0
@@ -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 [![Build Status](https://travis-ci.org/visionmedia/supertest.svg?branch=master)](https://travis-ci.org/visionmedia/supertest) [![npm version](https://badge.fury.io/js/supertest.svg)](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
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
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
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
47163
1201
13
2
+ Addedasync@1.5.2(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcomponent-emitter@1.2.1(transitive)
+ Addedcookiejar@2.0.6(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedextend@3.0.0(transitive)
+ Addedform-data@1.0.0-rc3(transitive)
+ Addedformidable@1.0.17(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedsuperagent@1.8.5(transitive)
- Removedasync@0.9.2(transitive)
- Removedcombined-stream@0.0.7(transitive)
- Removedcomponent-emitter@1.1.2(transitive)
- Removedcookiejar@2.0.1(transitive)
- Removeddelayed-stream@0.0.5(transitive)
- Removedextend@1.2.1(transitive)
- Removedform-data@0.2.0(transitive)
- Removedformidable@1.0.14(transitive)
- Removedmethods@1.0.1(transitive)
- Removedmime-db@1.12.0(transitive)
- Removedmime-types@2.0.14(transitive)
- Removedsuperagent@1.3.0(transitive)
Updatedsuperagent@^1.7.2