Skip to content

Commit

Permalink
[core][client] mirror window.location.protocol format in config (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
williaster authored and zhaoyongjie committed Nov 26, 2021
1 parent 446914e commit 1bc6e79
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 1bc6e79

Please sign in to comment.