Skip to content

Commit

Permalink
Fix a bug with season not loading stats
Browse files Browse the repository at this point in the history
  • Loading branch information
tiennou committed Oct 1, 2024
1 parent 1c7876e commit 5e077a1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/pushStats/apiFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,26 @@ function getRequestOptions(info, path, method = 'GET', body = {}) {
'Content-Length': Buffer.byteLength(JSON.stringify(body)),
};

const slashPos = info.host.indexOf('/');
let realPath = path;
let realHost = info.host;
if (slashPos !== -1) {
let hostPath = info.host.substring(slashPos + 1);
if (hostPath[hostPath.length - 1] !== '/' && path[0] !== '/') hostPath += '/';
realPath = hostPath + path;
realHost = info.host.substring(0, slashPos);
}

if (info.username) headers['X-Username'] = info.username;
if (info.token) headers['X-Token'] = info.token;
return {
host: info.host,
host: realHost,
port: info.port,
path,
path: realPath,
method,
headers,
body,
isHTTPS: info.type === 'mmo',
isHTTPS: info.type === 'mmo' || info.type === 'season',
};
}

Expand Down

0 comments on commit 5e077a1

Please sign in to comment.