Skip to content

Commit baf1ca4

Browse files
author
Harry Barber
committed
Contrast A with B
1 parent 8351af2 commit baf1ca4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

design/src/server/middleware.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ where `UpgradeLayer` is the `Layer` converting Smithy model structures to HTTP s
131131

132132
### A) Outer Middleware
133133

134-
The output of the Smithy service builder provides the user with a `Service<http::Request, Response = http::Response>` implementation. A `Layer` can be applied around this `Service`.
134+
The output of the Smithy service builder provides the user with a `Service<http::Request, Response = http::Response>` implementation. A `Layer` can be applied around the whole `Service`.
135135

136136
```rust
137137
// This is a HTTP `Service`.
@@ -163,7 +163,7 @@ let app /* : PokemonService<Route<B>> */ = PokemonService::builder()
163163
.layer(&trace_layer);
164164
```
165165

166-
Note that this middleware will _not_ be applied if routing fails. This means that the [TraceLayer](https://docs.rs/tower-http/latest/tower_http/trace/struct.TraceLayer.html) in the example above does _not_ provide logs unless routing has completed.
166+
Note that requests pass through this middleware immediately _after_ routing succeeds and therefore will _not_ be encountered if routing fails. This means that the [TraceLayer](https://docs.rs/tower-http/latest/tower_http/trace/struct.TraceLayer.html) in the example above does _not_ provide logs unless routing has completed. This contrasts to [middleware A](#a-outer-middleware), which _all_ requests/responses pass through when entering/leaving the service.
167167

168168
### C) Operation Specific HTTP Middleware
169169

0 commit comments

Comments
 (0)