mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-26 00:00:23 +02:00
Add MethodFilter::CONNECT (#2961)
This commit is contained in:
@@ -131,6 +131,19 @@ pub trait RouterExt<S>: sealed::Sealed {
|
||||
T: SecondElementIs<P> + 'static,
|
||||
P: TypedPath;
|
||||
|
||||
/// Add a typed `CONNECT` route to the router.
|
||||
///
|
||||
/// The path will be inferred from the first argument to the handler function which must
|
||||
/// implement [`TypedPath`].
|
||||
///
|
||||
/// See [`TypedPath`] for more details and examples.
|
||||
#[cfg(feature = "typed-routing")]
|
||||
fn typed_connect<H, T, P>(self, handler: H) -> Self
|
||||
where
|
||||
H: axum::handler::Handler<T, S>,
|
||||
T: SecondElementIs<P> + 'static,
|
||||
P: TypedPath;
|
||||
|
||||
/// Add another route to the router with an additional "trailing slash redirect" route.
|
||||
///
|
||||
/// If you add a route _without_ a trailing slash, such as `/foo`, this method will also add a
|
||||
@@ -255,6 +268,16 @@ where
|
||||
self.route(P::PATH, axum::routing::trace(handler))
|
||||
}
|
||||
|
||||
#[cfg(feature = "typed-routing")]
|
||||
fn typed_connect<H, T, P>(self, handler: H) -> Self
|
||||
where
|
||||
H: axum::handler::Handler<T, S>,
|
||||
T: SecondElementIs<P> + 'static,
|
||||
P: TypedPath,
|
||||
{
|
||||
self.route(P::PATH, axum::routing::connect(handler))
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn route_with_tsr(mut self, path: &str, method_router: MethodRouter<S>) -> Self
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user