]> piware.de Git - learn-rust.git/blobdiff - actix-server/src/main.rs
actix-server: Make hello route work with HEAD
[learn-rust.git] / actix-server / src / main.rs
index c73e7add5ee333cfecb7b72a2ac64e8595940b65..4a43ef55b36d8b1f2ccf31f84d11979a1efd35fd 100644 (file)
@@ -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<String>, req: HttpRequest) -> Result<String> {
     let name = params.into_inner();