buildUrlFromConfig -- canonicalHost

This commit is contained in:
Michael Bradley, Jr 2018-07-15 12:43:00 -05:00
parent 17e70e03dd
commit 96aeeaf0d1
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
let http = require('follow-redirects').http;
let https = require('follow-redirects').https;
const {canonicalHost} = require('./host');
function joinPath() {
const path = require('path');
@ -314,7 +315,7 @@ function buildUrl (protocol, host, port){
function buildUrlFromConfig (configObj){
if(!configObj) throw new Error('[utils.buildUrlFromConfig]: config object must cannot be null');
if(!configObj.host) throw new Error('[utils.buildUrlFromConfig]: object must contain a \'host\' property');
return this.buildUrl(configObj.protocol, configObj.host, configObj.port);
return this.buildUrl(configObj.protocol, canonicalHost(configObj.host), configObj.port);
}
function compact(array) {