diff options
| author | Fuwn <[email protected]> | 2023-03-29 08:28:56 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-03-29 08:34:11 +0000 |
| commit | e7f05fc3b45e3e068e8a8373782e7f519f40690d (patch) | |
| tree | b101bcfa9960ca7c7cbf9c2b735fb105b78357c8 /examples/windmark.rs | |
| parent | refactor(returnable): unify callback context (diff) | |
| download | windmark-e7f05fc3b45e3e068e8a8373782e7f519f40690d.tar.xz windmark-e7f05fc3b45e3e068e8a8373782e7f519f40690d.zip | |
feat(router): modify content from post-route callback
Diffstat (limited to 'examples/windmark.rs')
| -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() |