Merge pull request #260 from mvanhorn/fix/204-heartbeat-url-encoding
fix(cli): split path and query in buildUrl to prevent %3F encoding
This commit is contained in:
commit
17b10c43fe
1 changed files with 3 additions and 1 deletions
|
|
@ -104,8 +104,10 @@ export class PaperclipApiClient {
|
|||
|
||||
function buildUrl(apiBase: string, path: string): string {
|
||||
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
||||
const [pathname, query] = normalizedPath.split("?");
|
||||
const url = new URL(apiBase);
|
||||
url.pathname = `${url.pathname.replace(/\/+$/, "")}${normalizedPath}`;
|
||||
url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
|
||||
if (query) url.search = query;
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue