Actix-web. get query params of request, but get a error, no matches found

Hi Guys, I get a difficult. I need your help.
I want to extract query params of request, as follow code:

#[derive(Deserialize, Debug)]
pub struct Filter {
partail: Option
}
async fn get_persons(query: web::Query) -> impl Responder {
println!("In get_persons");
println!("{:?}", query);
query.partail.clone().unwrap_or_else(|| "".to_string())
}

server code:
HttpServer::new(move || {
App::new()
.service(web::resource("/persons").route(web::get().to(get_persons)))
.default_service(web::route().to(invalid_resource))
})

I think it's okay, but i get a error as follow when input "crul -X http://127.0.0.1/persons?partail=seed" on terimal.
zsh: no matches found: http://127.0.0.1/persons?partail=seed

What should I do?
creates and version:
actix-web = "4"
serde = "1"
serde_derive = "1"

You should read the error message more carefully.

The error comes form zsh, i.e., the shell, so this has nothing to do with Rust.

The ? metacharacter is a placeholder for any single character in a glob pattern; failing to quote the URL means that the shell tries to expand it, which you shouldn't do. Use single quotes instead:

curl -X 'http://127.0.0.1/persons?partail=seed'
1 Like

Yeah, thank you

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.