mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 09:54:41 -05:00
fix: allow custom status codes or redirects for route fallbacks (#3808)
This commit is contained in:
@@ -2061,7 +2061,15 @@ where
|
||||
},
|
||||
)
|
||||
.await;
|
||||
*res.status_mut() = StatusCode::NOT_FOUND;
|
||||
|
||||
// set the status to 404
|
||||
// but if the status was already set (for example, to a 302 redirect) don't
|
||||
// overwrite it
|
||||
let status = res.status_mut();
|
||||
if *status == StatusCode::OK {
|
||||
*res.status_mut() = StatusCode::NOT_FOUND;
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user