From 8c5aab4a40e93b9d0dce7d3cbe0dde0b7f58f7bb Mon Sep 17 00:00:00 2001 From: Chris Williams Date: Thu, 27 Sep 2018 14:17:10 -0700 Subject: [PATCH] [core][client] mirror window.location.protocol format in config (#8) --- packages/superset-ui-core/src/SupersetClient.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/superset-ui-core/src/SupersetClient.js b/packages/superset-ui-core/src/SupersetClient.js index 77f662388d60..e71750bf5bde 100644 --- a/packages/superset-ui-core/src/SupersetClient.js +++ b/packages/superset-ui-core/src/SupersetClient.js @@ -3,8 +3,8 @@ import callApi from './callApi'; class SupersetClient { constructor(config) { const { - protocol = 'http', - host = '', + protocol = 'http:', + host = 'localhost', headers = {}, mode = 'same-origin', timeout, @@ -15,7 +15,7 @@ class SupersetClient { this.host = host; this.mode = mode; this.timeout = timeout; - this.protocol = protocol; + this.protocol = `${protocol}${protocol.slice(-1) === ':' ? '' : ':'}`; this.credentials = credentials; this.csrfToken = null; this.didAuthSuccessfully = false; @@ -64,7 +64,7 @@ class SupersetClient { getUrl({ host = '', endpoint = '' }) { const cleanHost = host.slice(-1) === '/' ? host.slice(0, -1) : host; // no backslash - return `${this.protocol}://${cleanHost}/${endpoint[0] === '/' ? endpoint.slice(1) : endpoint}`; + return `${this.protocol}//${cleanHost}/${endpoint[0] === '/' ? endpoint.slice(1) : endpoint}`; } ensureAuth() {