mirror of
https://github.com/actix/actix-website
synced 2025-01-22 16:15:56 +01:00
clarify what happens when extractor fails
This commit is contained in:
parent
e7950a7272
commit
4aece987ac
@ -7,7 +7,8 @@ struct Info {
|
|||||||
username: String,
|
username: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
// this handler get called only if the request's query contains `username` field
|
// this handler gets called if the query deserializes into `Info` successfully
|
||||||
|
// otherwise a 400 Bad Request error response is returned
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
async fn index(info: web::Query<Info>) -> String {
|
async fn index(info: web::Query<Info>) -> String {
|
||||||
format!("Welcome {}!", info.username)
|
format!("Welcome {}!", info.username)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user