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

supertest

Package Overview
Dependencies
Maintainers
5
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supertest - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

5

History.md

@@ -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 @@ ===================

15

lib/test.js

@@ -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 @@

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