Как вернуть ошибку с http-сервера actix-web при получении дополнительного параметра запроса?

#rust #actix-web

Вопрос:

Следуя документации actix-веб-ящика, который я создал

 use serde::Deserialize;
use actix_web::{web, App, HttpServer};

#[derive(Debug, Deserialize)]
pub enum ResponseType {
   Token,
   Code
}

#[derive(Deserialize)]
pub struct AuthRequest {
   id: u64,
   response_type: ResponseType,
}

async fn index(web::Query(info): web::Query<AuthRequest>) -> String {
    format!("Authorization request for client with id={} and type={:?}!", info.id, info.response_type)
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| App::new().service(web::resource("/index.html").route(web::get().to(index))))
        .bind("127.0.0.1:8080")?
        .run()
        .await
}
 

Это отлично работает, когда я выполняю ПЕРЕХОД к

 http://localhost:8080/index.html?id=1amp;response_type=Code
 

Интересно, можно ли каким-то образом заставить сервер возвращать ошибку, когда в URL-адресе есть дополнительный параметр запроса, например

 http://localhost:8080/index.html?id=1amp;response_type=Codeamp;wrong_parameter=1
 

С кодом, который я опубликовал, wrong_parameter просто игнорируется.