Skip to content

Commit

Permalink
Ensure args are encoded when fetching server function (#1409)
Browse files Browse the repository at this point in the history
* Ensure args are encoded when fetching server function

* Create friendly-experts-raise.md

---------

Co-authored-by: Ryan Carniato <[email protected]>
  • Loading branch information
thdxr and ryansolid authored Mar 22, 2024
1 parent 6dd28eb commit c09d4bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-experts-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/start": patch
---

Ensure args are encoded when fetching server function
4 changes: 2 additions & 2 deletions packages/start/src/runtime/server-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c09d4bd

Please sign in to comment.