diff options
| author | Fuwn <[email protected]> | 2023-03-31 23:55:20 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-03-31 23:55:20 +0000 |
| commit | 687f3778f2fed2fe4aba8027c215ce91c54648ed (patch) | |
| tree | 3358e7db7f4287bcc7bc2e8deeb22e94bfeaffae /src | |
| parent | fix(cargo): response-macros feature flag (diff) | |
| download | windmark-687f3778f2fed2fe4aba8027c215ce91c54648ed.tar.xz windmark-687f3778f2fed2fe4aba8027c215ce91c54648ed.zip | |
feat(router): expose response to post-route callback
Diffstat (limited to 'src')
| -rw-r--r-- | src/handler.rs | 2 | ||||
| -rw-r--r-- | src/router.rs | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/handler.rs b/src/handler.rs index bd64f03..3429f3b 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -28,5 +28,5 @@ pub type ErrorResponse = Box<dyn FnMut(returnable::ErrorContext<'_>) -> Response + Send + Sync>; pub type Callback = Box<dyn FnMut(CallbackContext<'_>) + Send + Sync>; pub type CleanupCallback = - Box<dyn FnMut(CallbackContext<'_>, &mut String) + Send + Sync>; + Box<dyn FnMut(CallbackContext<'_>, &mut Response) + Send + Sync>; pub type Partial = Box<dyn FnMut(RouteContext<'_>) -> String + Send + Sync>; diff --git a/src/router.rs b/src/router.rs index a89f230..b2c0435 100644 --- a/src/router.rs +++ b/src/router.rs @@ -326,6 +326,7 @@ impl Router { &stream.ssl().peer_certificate(), )); + let peer_certificate = stream.ssl().peer_certificate(); let mut content = if let Ok(ref route) = route { let footers_length = (*self.footers.lock().unwrap()).len(); @@ -364,13 +365,13 @@ impl Router { stream.get_ref(), &url, &route.params, - &stream.ssl().peer_certificate(), + &peer_certificate, )) } else { (*self.error_handler).lock().unwrap()(ErrorContext::new( stream.get_ref(), &url, - &stream.ssl().peer_certificate(), + &peer_certificate, )) }; @@ -390,7 +391,7 @@ impl Router { route.as_ref().map_or(None, |route| Some(&route.params)), &stream.ssl().peer_certificate(), ), - &mut content.content, + &mut content, ); stream |