From f43a7063642bebe8b76f472beb5a9d6dfdb42ed6 Mon Sep 17 00:00:00 2001 From: Folyd Date: Tue, 26 Nov 2019 19:40:29 +0800 Subject: [PATCH] Set name for each generated resource --- actix-web-codegen/src/route.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actix-web-codegen/src/route.rs b/actix-web-codegen/src/route.rs index f8e2496c4..16d3e8157 100644 --- a/actix-web-codegen/src/route.rs +++ b/actix-web-codegen/src/route.rs @@ -184,6 +184,7 @@ impl Route { pub fn generate(&self) -> TokenStream { let name = &self.name; + let resource_name = name.to_string(); let guard = &self.guard; let ast = &self.ast; let path = &self.args.path; @@ -196,8 +197,8 @@ impl Route { impl actix_web::dev::HttpServiceFactory for #name { fn register(self, config: &mut actix_web::dev::AppService) { #ast - let resource = actix_web::Resource::new(#path) + .name(#resource_name) .guard(actix_web::guard::#guard()) #(.guard(actix_web::guard::fn_guard(#extra_guards)))* .#resource_type(#name);