-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
fullstack: server fn with -> Result<SetHeader<SetCookie>> always returns Some(Ok(SetHeader { data: None })) to client, browser kinda receives the proper HttpError's message as response json, but with 500 as code on Err no matter what.
Steps To Reproduce
check out the example
dioxus/examples/07-fullstack/login_form.rs
Lines 75 to 90 in 2da0193
| /// In our `login` form, we'll return a `SetCookie` header if the login is successful. | |
| /// | |
| /// This will set a cookie in the user's browser that can be used for subsequent authenticated requests. | |
| /// The `SetHeader::new()` method takes anything that can be converted into a `HeaderValue`. | |
| /// | |
| /// We can set multiple headers by returning a tuple of `SetHeader` types, or passing in a tuple | |
| /// of headers to `SetHeader::new()`. | |
| #[post("/api/login")] | |
| async fn login(form: Form<LoginForm>) -> Result<SetHeader<SetCookie>> { | |
| // Verify the username and password. In a real application, you'd check these against a database. | |
| if form.0.username == "admin" && form.0.password == "password" { | |
| return Ok(SetHeader::new(format!("auth-demo={};", &*THIS_SESSION_ID))?); | |
| } | |
| HttpError::unauthorized("Invalid username or password")? | |
| } |
Steps to reproduce the behavior:
git clone https://github.com/dioxuslabs/dioxus- add a
preon line 38, just likebut withpre { "Response from locked API: {fetch_sensitive.value():?}"} fetch_login dx serve --example login_form- check login thingy
Expected behavior
make the dioxus client receive the proper Result<_, _> to be able to handle the Err properly, display the message to the user if necessary
Screenshots
Environment:
- Dioxus version: 0.7.2 (35351eb)
- Rust version: 1.92.0 (ded5c06cf 2025-12-08)
- OS info: aarch64 macos 26.1, tested on x86_64 (arch) linux as well, most probably not os specific
- App platform: fullstack (web or desktop+server)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working