mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-28 01:52:57 +01:00
fix nested resources
This commit is contained in:
parent
244fff9e0a
commit
60c048c8cd
@ -32,8 +32,6 @@ use crate::{HttpMessage, HttpResponse};
|
||||
/// %a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T
|
||||
/// ```
|
||||
/// ```rust
|
||||
/// # extern crate actix_web;
|
||||
/// extern crate env_logger;
|
||||
/// use actix_web::middleware::Logger;
|
||||
/// use actix_web::App;
|
||||
///
|
||||
@ -43,8 +41,7 @@ use crate::{HttpMessage, HttpResponse};
|
||||
///
|
||||
/// let app = App::new()
|
||||
/// .middleware(Logger::default())
|
||||
/// .middleware(Logger::new("%a %{User-Agent}i"))
|
||||
/// .finish();
|
||||
/// .middleware(Logger::new("%a %{User-Agent}i"));
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
|
@ -283,7 +283,7 @@ where
|
||||
} else {
|
||||
Some(std::mem::replace(&mut self.guards, Vec::new()))
|
||||
};
|
||||
let rdef = if config.is_root() {
|
||||
let rdef = if config.is_root() || !self.rdef.is_empty() {
|
||||
ResourceDef::new(&insert_slash(&self.rdef))
|
||||
} else {
|
||||
ResourceDef::new(&self.rdef)
|
||||
|
11
src/scope.rs
11
src/scope.rs
@ -262,12 +262,11 @@ where
|
||||
} else {
|
||||
Some(self.guards)
|
||||
};
|
||||
let rdef = if config.is_root() {
|
||||
ResourceDef::root_prefix(&self.rdef)
|
||||
} else {
|
||||
ResourceDef::prefix(&self.rdef)
|
||||
};
|
||||
config.register_service(rdef, guards, self.endpoint)
|
||||
config.register_service(
|
||||
ResourceDef::root_prefix(&self.rdef),
|
||||
guards,
|
||||
self.endpoint,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user