diff options
| author | Fuwn <[email protected]> | 2023-03-29 08:28:56 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-03-29 08:28:56 +0000 |
| commit | 391038b6a67ddea3d3efb67c44bb3feb64360eae (patch) | |
| tree | b2c311e490c16a111822bf9fc00f4fbc41e68481 /examples | |
| parent | refactor(returnable): unify callback context (diff) | |
| download | windmark-391038b6a67ddea3d3efb67c44bb3feb64360eae.tar.xz windmark-391038b6a67ddea3d3efb67c44bb3feb64360eae.zip | |
feat(router): modify content from post-route callback
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/windmark.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/windmark.rs b/examples/windmark.rs index fca1c97..b33f686 100644 --- a/examples/windmark.rs +++ b/examples/windmark.rs @@ -82,7 +82,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { context.url.to_string() ) })); - router.set_post_route_callback(Box::new(|context| { + router.set_post_route_callback(Box::new(|context, content| { + *content = content.replace("Welcome!", "Welcome to Windmark!"); + info!( "closed connection from {}", context.tcp.peer_addr().unwrap().ip() |