[bug] Fix wrong api calls for storeData
This commit is contained in:
parent
e8c2d1a05a
commit
3f64369852
@ -7,14 +7,13 @@ export async function storeData(servers: string[], key: string, value: Blob, ttl
|
||||
let url: string;
|
||||
if (server.startsWith('/')) {
|
||||
// Relative path - construct manually for proxy
|
||||
url = `${server}/store?key=${encodeURIComponent(key)}`;
|
||||
url = `${server}/store/${encodeURIComponent(key)}`;
|
||||
if (ttl !== null) {
|
||||
url += `&ttl=${ttl}`;
|
||||
url += `?ttl=${ttl}`;
|
||||
}
|
||||
} else {
|
||||
// Absolute URL - use URL constructor
|
||||
const urlObj = new URL(`${server}/store`);
|
||||
urlObj.searchParams.append('key', key);
|
||||
const urlObj = new URL(`${server}/store/${encodeURIComponent(key)}`);
|
||||
if (ttl !== null) {
|
||||
urlObj.searchParams.append('ttl', ttl.toString());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user