Closed
Description
The FromParam
docs say:
If the conversion fails, the incoming request will be forwarded to the next matching route, if any.
Since there are no additional matching routes, this example will result in a 404 error for requests with invalid
id
values.
However, the actual behavior of such an endpoint when requested with a non-usize
parameter is to return 422 Unprocessable Content:
#[rocket::get("/<id>")]
fn hello(id: usize) -> String {
id.to_string()
}
#[rocket::launch]
async fn launch() -> _ {
rocket::build()
.mount("/", rocket::routes![
hello,
])
}
Tested on Rocket commit 3bf9ef0.
Discussed in #2879
Metadata
Metadata
Assignees
Labels
No labels