1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-21 05:05:44 +02:00

refactor Scope (#1895)

This commit is contained in:
fakeshadow
2021-01-10 02:06:49 +08:00
committed by GitHub
parent fe392abeb4
commit 9e401b6ef7
2 changed files with 71 additions and 147 deletions

View File

@@ -62,7 +62,8 @@ where
type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>;
fn new_service(&self, config: AppConfig) -> Self::Future {
// update resource default service
// set AppService's default service to 404 NotFound
// if no user defined default service exists.
let default = self.default.clone().unwrap_or_else(|| {
Rc::new(boxed::factory(fn_service(|req: ServiceRequest| async {
Ok(req.into_response(Response::NotFound().finish()))