Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions tower-http/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,26 @@ pub trait ServiceBuilderExt<L>: sealed::Sealed<L> + Sized {
>,
>;

/// Follow redirect responses using the [`Standard`] policy,
/// storing it as an extension.
///
/// See [`tower_http::follow_redirect`] for more details.
///
/// [`tower_http::follow_redirect`]: crate::follow_redirect
/// [`Standard`]: crate::follow_redirect::policy::Standard
#[cfg(feature = "follow-redirect")]
fn follow_redirects_extension(
self,
) -> ServiceBuilder<
Stack<
crate::follow_redirect::FollowRedirectLayer<
crate::follow_redirect::policy::Standard,
crate::follow_redirect::UriAndPolicyExtensions,
>,
L,
>,
>;

/// Mark headers as [sensitive] on both requests and responses.
///
/// See [`tower_http::sensitive_headers`] for more details.
Expand Down Expand Up @@ -459,6 +479,25 @@ impl<L> ServiceBuilderExt<L> for ServiceBuilder<L> {
self.layer(crate::follow_redirect::FollowRedirectLayer::new())
}

#[cfg(feature = "follow-redirect")]
fn follow_redirects_extension(
self,
) -> ServiceBuilder<
Stack<
crate::follow_redirect::FollowRedirectLayer<
crate::follow_redirect::policy::Standard,
crate::follow_redirect::UriAndPolicyExtensions,
>,
L,
>,
> {
self.layer(
crate::follow_redirect::FollowRedirectLayer::with_policy_extension(
crate::follow_redirect::policy::Standard::default(),
),
)
}

#[cfg(feature = "sensitive-headers")]
fn sensitive_headers<I>(
self,
Expand Down
Loading