Allow trailing slashes in seed API

This commit is contained in:
Alexis Sellier
2021-08-22 21:48:15 +02:00
parent c90cf21952
commit e39e425ec4
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -14,8 +14,9 @@ export async function get(
query[key] = val.toString();
}
const base = config.seed.api.replace(/\/$/, "");
const search = new URLSearchParams(query).toString();
const baseUrl = `${config.seed.api}/v1/${path}`;
const baseUrl = `${base}/v1/${path}`;
const url = search ? `${baseUrl}?${search}` : baseUrl;
let response = null;
+1 -1
View File
@@ -129,7 +129,7 @@ export class Config {
withSeed(seed: string): Config {
const cfg = {} as Config;
Object.assign(cfg, this);
cfg.seed.api = seed;
cfg.seed.api = seed.replace(/\/$/, "");
return cfg;
}