Skip to content

Commit

Permalink
Assign URL to a different name
Browse files Browse the repository at this point in the history
  • Loading branch information
Marios Antonoudiou committed May 30, 2018
1 parent 2a710f8 commit dedaf59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {URL} = require('url');
const {URL: UrlParser} = require('url');

function testParameter(name, filters) {
return filters.some(filter => filter instanceof RegExp ? filter.test(name) : filter === name);
Expand Down Expand Up @@ -27,7 +27,7 @@ module.exports = (urlString, opts) => {
urlString = urlString.replace(/^(?!(?:\w+:)?\/\/)|^\/\//, 'http://');
}

const urlObj = new URL(urlString);
const urlObj = new UrlParser(urlString);

if (opts.normalizeHttps && urlObj.protocol === 'https:') {
urlObj.protocol = 'http:';
Expand Down

0 comments on commit dedaf59

Please sign in to comment.