Skip to content

Commit d2bf7c9

Browse files
Arihant JainArihant Jain
authored andcommitted
Remove any protocol part from --proxy-host
1 parent 9666cee commit d2bf7c9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/commandLine.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,13 @@ var CommandLineManager = {
119119
index = argv.indexOf('--proxy-host');
120120
if (index !== -1) {
121121
if (CommandLineManager.validArgValue(argv[index + 1])) {
122+
var hostRegex = /(^\w+:|^)\/\//;
123+
var host = argv[index + 1];
124+
if (host.match(hostRegex)) {
125+
host = host.replace(/(^\w+:|^)\/\//, '');
126+
}
122127
RdGlobalConfig.proxy = RdGlobalConfig.proxy || {};
123-
RdGlobalConfig.proxy.host = argv[index + 1];
128+
RdGlobalConfig.proxy.host = host;
124129
argv.splice(index, 2);
125130
} else {
126131
invalidArgs.add('--proxy-host');

test/commandLine.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('CommandLineManager', function () {
3131

3232
it('parse proxy-host and proxy-port params', function () {
3333
sinon.stub(console, 'log');
34-
argv = argv.concat(['--proxy-host', 'host', '--proxy-port', '9687']);
34+
argv = argv.concat(['--proxy-host', 'http://host', '--proxy-port', '9687']);
3535
CommandLineManager.processArgs(argv);
3636
console.log.restore();
3737
expect(RdGlobalConfig.proxy.host).to.eql('host');

0 commit comments

Comments
 (0)