fix: encode URI for node name in case it contains special chars

This commit is contained in:
shunf4 2020-12-30 16:39:08 +08:00
parent c4150a4edf
commit 877291334e

View file

@ -37,7 +37,7 @@ export async function requestDelayForProxy(
) { ) {
const { url, init } = getURLAndInit(apiConfig); const { url, init } = getURLAndInit(apiConfig);
const qs = `timeout=5000&url=${latencyTestUrl}`; const qs = `timeout=5000&url=${latencyTestUrl}`;
const fullURL = `${url}${endpoint}/${name}/delay?${qs}`; const fullURL = `${url}${endpoint}/${encodeURIComponent(name)}/delay?${qs}`;
return await fetch(fullURL, init); return await fetch(fullURL, init);
} }