Skip to content

Query Params on Server macro #3510

Closed Answered by gbj
roysabenecio asked this question in Q&A
Jan 22, 2025 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

That's what I'm trying to say: "server functions" are an abstraction, where the arguments are encoded in specific ways. So, for a POST request, all of the arguments are encoded in the body of the request. For a GET request, all of the arguments are encoded as query params. etc.

So if you are defining a server function and you want to call it with a particular id, you do not pass it as part of the path: you pass it as the request body, just like an HTML <form method="POST"> would.

If you want the flexibility to be able to do things like passing arguments via path params, you should just define an ordinary Axum route rather than trying to use a server function.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@roysabenecio
Comment options

@gbj
Comment options

gbj Jan 24, 2025
Maintainer

Answer selected by roysabenecio
@roysabenecio
Comment options

@gbj
Comment options

gbj Jan 24, 2025
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants