Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lib/test.js] Support URLs without leading slash #512

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/test.js
Expand Up @@ -7,6 +7,7 @@ var util = require('util');
var http = require('http');
var https = require('https');
var assert = require('assert');
var url = require('url');
var Request = request.Request;

/**
Expand Down Expand Up @@ -59,7 +60,7 @@ Test.prototype.serverAddress = function(app, path, host) {
if (!addr) this._server = app.listen(0);
port = app.address().port;
protocol = app instanceof https.Server ? 'https' : 'http';
return protocol + '://' + (host || '127.0.0.1') + ':' + port + path;
return url.resolve(protocol + '://' + (host || '127.0.0.1') + ':' + port, path);
};

/**
Expand Down