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

supertest-session

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supertest-session - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

21

index.js

@@ -5,2 +5,3 @@ var assign = require('object-assign'),

util = require('util'),
http = require('http'),
CookieAccess = require('cookiejar').CookieAccessInfo,

@@ -16,3 +17,14 @@ parse = require('url').parse;

var url = app;
this.agent = supertest.agent(this.app, this.options);
if (typeof app === 'function') {
app = http.createServer(app);
url = supertest.Test.prototype.serverAddress(app, '/');
}
this.app = app;
this.url = parse(url);
this.options = options || {};

@@ -34,3 +46,3 @@ this.reset();

var url, cookieAccessOptions, domain, path, secure, script;
var cookieAccessOptions, domain, path, secure, script;

@@ -47,7 +59,6 @@ // Unset supertest-session options before forwarding options to superagent.

url = parse(this.agent.get('').url);
cookieAccessOptions = this.options.cookieAccess || {};
domain = cookieAccessOptions.domain || url.hostname;
path = cookieAccessOptions.path || url.path;
secure = !!cookieAccessOptions.secure || 'https:' == url.protocol;
domain = cookieAccessOptions.domain || this.url.hostname;
path = cookieAccessOptions.path || this.url.path;
secure = !!cookieAccessOptions.secure || 'https:' == this.url.protocol;
script = !!cookieAccessOptions.script || false;

@@ -54,0 +65,0 @@ this.cookieAccess = CookieAccess(domain, path, secure, script);

{
"name": "supertest-session",
"version": "3.1.0",
"version": "3.1.1",
"description": "Cookie-based session persistence for Supertest",

@@ -5,0 +5,0 @@ "main": "index.js",

var assert = require('assert'),
http = require('http'),
app = require('./app'),

@@ -61,18 +62,21 @@ session = require('../index');

var serverUrl, test;
var sess,
server = http.createServer(app);
beforeEach(function () {
// use supertest to set up the app.js server, returning a `Test` instance
test = session(app).request('get', '');
// obtain the running server's URL
serverUrl = test.url;
beforeEach(function (done) {
server.listen(0, function (err) {
if (err) {
return done(err);
}
sess = session('http://127.0.0.1:' + server.address().port);
done();
});
});
afterEach(function (done) {
test.end(done);
server.close(done);
});
it('behaves correctly', function (done) {
sess = session(serverUrl)
sess
.get('/')

@@ -79,0 +83,0 @@ .expect(200)

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