Skip to content

Commit 9b6c649

Browse files
committed
axum-extra: Adjust to new option_layer() type signature
1 parent 63bc9e2 commit 9b6c649

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/middleware.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod update_metrics;
1313

1414
use ::sentry::integrations::tower as sentry_tower;
1515
use axum::Router;
16-
use axum::middleware::{from_fn, from_fn_with_state};
16+
use axum::middleware::{ResponseAxumBodyLayer, from_fn, from_fn_with_state};
1717
use axum_extra::either::Either;
1818
use axum_extra::middleware::option_layer;
1919
use std::time::Duration;
@@ -90,6 +90,9 @@ pub fn apply_axum_middleware(state: AppState, router: Router<()>) -> Router {
9090
.layer(CompressionLayer::new().quality(CompressionLevel::Fastest))
9191
}
9292

93-
pub fn conditional_layer<L, F: FnOnce() -> L>(condition: bool, layer: F) -> Either<L, Identity> {
93+
pub fn conditional_layer<L, F: FnOnce() -> L>(
94+
condition: bool,
95+
layer: F,
96+
) -> Either<(ResponseAxumBodyLayer, L), Identity> {
9497
option_layer(condition.then(layer))
9598
}

0 commit comments

Comments
 (0)