diff --git a/.changeset/friendly-experts-raise.md b/.changeset/friendly-experts-raise.md new file mode 100644 index 000000000..6282178f4 --- /dev/null +++ b/.changeset/friendly-experts-raise.md @@ -0,0 +1,5 @@ +--- +"@solidjs/start": patch +--- + +Ensure args are encoded when fetching server function diff --git a/packages/start/src/runtime/server-runtime.ts b/packages/start/src/runtime/server-runtime.ts index 16d6d5d94..bcb766191 100644 --- a/packages/start/src/runtime/server-runtime.ts +++ b/packages/start/src/runtime/server-runtime.ts @@ -202,8 +202,8 @@ export function createServerReference(fn: Function, id: string, name: string) { const encodeArgs = options.method && options.method.toUpperCase() === "GET"; return fetchServerFunction( encodeArgs - ? url + (args.length ? `&args=${JSON.stringify(await Promise.resolve( - toJSONAsync(args, { plugins })))}` : "") + ? url + (args.length ? `&args=${encodeURIComponent(JSON.stringify(await Promise.resolve( + toJSONAsync(args, { plugins }))))}` : "") : `${baseURL}/_server`, `${id}#${name}`, options,