You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// and send it back to other middlewares on the chain
78
+
res.headers_mut().insert(
79
+
header::CONTENT_TYPE,
80
+
"text/html; charset=utf-8".parse().unwrap(),
81
+
);
82
+
71
83
Ok(res)
72
84
}
73
85
@@ -93,7 +105,7 @@ async fn main() -> Result {
93
105
handler.link_before(FirstMiddleware {});
94
106
handler.link_after(SecondMiddleware {});
95
107
96
-
// 3. Create a Hyper service and set the current handler with its middlewares
108
+
// 3. Create an Hyper service and set the current handler with its middlewares
97
109
letservice=Service::new(handler);
98
110
99
111
// 4. Finally just run server using the service already created
@@ -108,6 +120,12 @@ async fn main() -> Result {
108
120
}
109
121
```
110
122
123
+
To run the example just type:
124
+
125
+
```
126
+
cargo run --example server
127
+
```
128
+
111
129
## Contributions
112
130
113
131
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.
0 commit comments