1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-20 08:31:09 +00:00

fix nested resources

This commit is contained in:
Nikolay Kim 2019-03-06 19:27:18 -08:00
parent 244fff9e0a
commit 60c048c8cd
3 changed files with 7 additions and 11 deletions

View file

@ -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"));
/// }
/// ```
///

View file

@ -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)

View file

@ -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,
)
}
}