Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,6 @@ | ||
1.0.1 / 2015-05-08 | ||
=================== | ||
* PR-224 - Better expected error support as result of super-agent 1.x | ||
1.0.0 / 2015-05-08 | ||
@@ -2,0 +7,0 @@ =================== |
@@ -201,6 +201,13 @@ /** | ||
// status | ||
if (status && res.status !== status) { | ||
var a = http.STATUS_CODES[status]; | ||
var b = http.STATUS_CODES[res.status]; | ||
return fn(new Error('expected ' + status + ' "' + a + '", got ' + res.status + ' "' + b + '"'), res); | ||
if (status) { | ||
if (res.status !== status) { | ||
var a = http.STATUS_CODES[status]; | ||
var b = http.STATUS_CODES[res.status]; | ||
return fn(new Error('expected ' + status + ' "' + a + '", got ' + res.status + ' "' + b + '"'), res); | ||
} | ||
// remove expected superagent error | ||
if (resError && resError instanceof Error && resError.status === status) { | ||
resError = null; | ||
} | ||
} | ||
@@ -207,0 +214,0 @@ |
{ | ||
"name": "supertest", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Super-agent driven library for testing HTTP servers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -63,17 +63,5 @@ # SuperTest [![Build Status](https://travis-ci.org/visionmedia/supertest.svg?branch=master)](https://travis-ci.org/visionmedia/supertest) | ||
One thing to note with the above statement is that superagent now sends any HTTP | ||
error (anything other than a 2XX response code) to the callback as the first arguement. Example: | ||
error (anything other than a 2XX response code) to the callback as the first argument if | ||
you do not add a status code expect (i.e. `.expect(302)`). | ||
```js | ||
describe('GET /redirect-url', function(){ | ||
it('respond with 302 redirect', function(done){ | ||
request(app) | ||
.get('/redirect-url') | ||
.expect(302, function (error) { | ||
(error !== null).should.be.true; | ||
done(); | ||
}); | ||
}) | ||
}) | ||
``` | ||
If you are using the `.end()` method `.expect()` assertions that fail will | ||
@@ -80,0 +68,0 @@ not throw - they will return the assertion as an error to the `.end()` callback. In |
@@ -158,3 +158,3 @@ | ||
.get('/') | ||
.expect(302, function() { done(); }); | ||
.expect(302, done); | ||
}); | ||
@@ -161,0 +161,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
39383
973
5
201