From 1214c324a2c04ff166d49bffeb0de5e18b04eca0 Mon Sep 17 00:00:00 2001 From: dowwie Date: Mon, 29 Apr 2019 07:10:56 -0400 Subject: [PATCH] added clarification to docs regarding middleware processing sequnce --- src/app.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index bb6d2aef8..b478b6c07 100644 --- a/src/app.rs +++ b/src/app.rs @@ -301,7 +301,15 @@ where /// lifecycle (request -> response), modifying request/response as /// necessary, across all requests managed by the *Application*. /// - /// Use middleware when you need to read or modify *every* request or response in some way. + /// Use middleware when you need to read or modify *every* request or + /// response in some way. + /// + /// Notice that the keyword for registering middleware is `wrap`. As you + /// register middleware using `wrap` in the App builder, imagine wrapping + /// layers around an inner App. The first middleware layer exposed to a + /// Request is the outermost layer-- the *last* registered in + /// the builder chain. Consequently, the *first* middleware registered + /// in the builder chain is the *last* to execute during request processing. /// /// ```rust /// use actix_service::Service;