Fix urlString function for multiple arguments

This commit is contained in:
Konstantin Wohlwend 2025-02-12 14:35:15 -08:00
parent 8bdc6bb3ae
commit c280f35d4f
3 changed files with 3 additions and 3 deletions

View File

@ -368,7 +368,7 @@ export class StackClientInterface {
} else {
const error = await res.text();
const errorObj = new StackAssertionError(`Failed to send request to ${url}: ${res.status} ${error}`, { request: params, res });
const errorObj = new StackAssertionError(`Failed to send request to ${url}: ${res.status} ${error}`, { request: params, res, path });
if (res.status === 508 && error.includes("INFINITE_LOOP_DETECTED")) {
// Some Vercel deployments seem to have an odd infinite loop bug. In that case, retry.

View File

@ -76,7 +76,7 @@ export function trimLines(s: string): string {
*
* Useful for implementing your own template literal tags.
*/
export function templateIdentity(strings: TemplateStringsArray | readonly string[], ...values: any[]): string {
export function templateIdentity(strings: TemplateStringsArray | readonly string[], ...values: string[]): string {
return strings.reduce((result, str, i) => result + str + (values[i] ?? ''), '');
}

View File

@ -51,7 +51,7 @@ export function url(strings: TemplateStringsArray | readonly string[], ...values
* Any values passed are encoded.
*/
export function urlString(strings: TemplateStringsArray | readonly string[], ...values: (string|number|boolean)[]): string {
return templateIdentity(strings, values.map(encodeURIComponent));
return templateIdentity(strings, ...values.map(encodeURIComponent));
}