Fix ratelimiting example
Geeze, that code's ancient! How long was that broken?
This commit is contained in:
parent
b265ae985c
commit
3e2865de12
|
@ -17,8 +17,7 @@ async fn main() -> Result<()> {
|
|||
.await
|
||||
}
|
||||
|
||||
fn handle_request(request: Request) -> BoxFuture<'static, Result<Response>> {
|
||||
async move {
|
||||
async fn handle_request(request: Request) -> Result<Response> {
|
||||
let mut document = Document::new();
|
||||
|
||||
if let Some("limit") = request.trailing_segments().get(0).map(String::as_str) {
|
||||
|
@ -31,7 +30,5 @@ fn handle_request(request: Request) -> BoxFuture<'static, Result<Response>> {
|
|||
document.add_blank_line()
|
||||
.add_link("/limit", "Go to rate limited page")
|
||||
.add_link("/", "Go to a page that's not rate limited");
|
||||
Ok(Response::document(document))
|
||||
}
|
||||
.boxed()
|
||||
Ok(document.into())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue