From: Martin Pitt Date: Sat, 10 Dec 2022 11:34:07 +0000 (+0100) Subject: actix-server: Make hello route work with HEAD X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=7580ac5646156d35fd83b65f7d0bd959a896fb6c;p=learn-rust.git actix-server: Make hello route work with HEAD This is a little bit tricky: https://github.com/actix/actix-web/issues/2702 --- diff --git a/actix-server/src/main.rs b/actix-server/src/main.rs index c73e7ad..4a43ef5 100644 --- a/actix-server/src/main.rs +++ b/actix-server/src/main.rs @@ -1,11 +1,11 @@ use std::path::Path; -use actix_web::{get, web, App, HttpRequest, HttpServer, Responder, Result}; +use actix_web::{get, route, web, App, HttpRequest, HttpServer, Responder, Result}; use actix_web::http::header; use actix_web::middleware::Logger; use actix_files::{Files, NamedFile}; -#[get("/hello/{name}")] +#[route("/hello/{name}", method="GET", method="HEAD")] async fn hello(params: web::Path, req: HttpRequest) -> Result { let name = params.into_inner();