Skip to content

Query parameters not passed to server functions with web feature (#[get]) #4828

@bwskin

Description

@bwskin

Problem

When using server functions with the web crate feature, query parameter mapping for #[get] routes does not work.

Example:

#[get("/api/param_echo?input")]
async fn param_echo(input: String) -> Result<String, ServerFnError> {
    Ok(input)
}

The input parameter is not passed from the frontend — the server receives no query parameters and returns HTTP 400.

If the same endpoint is invoked manually (e.g., with curl or directly in the browser, including the query parameter), everything works correctly, which indicates that the browser part is not attaching the query param properly.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Clone the reproduction repo: https://github.com/bwskin/serverfn_get_param_reproduce
  2. cd serverfn_get_param_reproduce && dx serve
  3. Open the app in the browser and type some text into input, triggering echo server function.
  4. Observe that the request returns 400 Bad Request.
  5. Invoke the same endpoint manually (e.g., curl http://127.0.0.1:8080/api/param_echo?input=test) — it works as expected.

Expected behavior

The input query parameter should be sent from the frontend to the server, allowing the server function to receive it correctly.

Environment:

  • Dioxus version: v0.7.0-rc.3 / main (321032c)
  • Rust version: 1.92.0-nightly
  • App platform: web

Questionnaire
I would like to fix and I have a solution (#4827).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions