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
- move the server header to the router and add it to all responses.
- move the response boxing to the router simplifying the return types of
each handler.
hyperium/http-body#150 will simplify the router
code even futher to the following:
```rust
let mut response = match request.uri().path() {
"/ping" => ping()?.box_body(),
"/json" => json::get()?.box_body(),
"/db" => single_query::get().await?.box_body(),
"/queries" => multiple_queries::get(request.uri().query()).await?.box_body(),
"/fortunes" => fortunes::get().await?.box_body(),
"/plaintext" => plaintext::get()?.box_body(),
_ => not_found_error()?.box_body(),
};
```
0 commit comments