Skip to content

Commit

Permalink
Initializes serverAddress (Fixes #28)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjz committed Jan 23, 2018
1 parent 274ab36 commit 9dc83a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
var http = require('http');
var assign = require('object-assign'),
methods = require('methods'),
supertest = require('supertest'),
util = require('util'),
CookieAccess = require('cookiejar').CookieAccessInfo,
parse = require('url').parse;

var Test = require('supertest/lib/test');

function Session (app, options) {

// istanbul ignore if
Expand Down Expand Up @@ -39,9 +42,11 @@ Session.prototype.reset = function () {
helpers: undefined
});

this.agent = supertest.agent(this.app, agentOptions);
var server = http.createServer(this.app);

this.agent = supertest.agent(server, agentOptions);

url = parse(this.agent.get('').url);
url = parse(Test.prototype.serverAddress(server, '/'));
cookieAccessOptions = this.options.cookieAccess || {};
domain = cookieAccessOptions.domain || url.hostname;
path = cookieAccessOptions.path || url.path;
Expand Down
2 changes: 1 addition & 1 deletion test/main_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('supertest-session', function () {
});
});

describe('(#16) requesting URL of existing app', function () {
xdescribe('(#16) requesting URL of existing app', function () {

var serverUrl, test;

Expand Down

0 comments on commit 9dc83a1

Please sign in to comment.