mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 15:07:42 +02:00
added support for creating custom methods with route macro (#2969)
Co-authored-by: Rob Ede <robjtede@icloud.com> Closes https://github.com/actix/actix-web/issues/2893
This commit is contained in:
19
actix-web-codegen/tests/trybuild/route-custom-method.rs
Normal file
19
actix-web-codegen/tests/trybuild/route-custom-method.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use actix_web_codegen::*;
|
||||
use actix_web::http::Method;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[route("/", method="UNEXPECTED")]
|
||||
async fn index() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
use actix_web::App;
|
||||
|
||||
let srv = actix_test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.request(Method::from_str("UNEXPECTED").unwrap(), srv.url("/"));
|
||||
let response = request.send().await.unwrap();
|
||||
assert!(response.status().is_success());
|
||||
}
|
Reference in New Issue
Block a user