diff --git a/CHANGELOG.md b/CHANGELOG.md index 81b0c84d..6d4685d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 match any routes ([#408]) - **breaking:** `EmptyRouter` has been renamed to `MethodNotAllowed` as its only used in method routers and not in path routers (`Router`) + - **breaking:** Remove support for routing based on the `CONNECT` method. An + example of combining axum with and HTTP proxy can be found [here][proxy] ([#428]) - Extractors: - **fixed:** Expand accepted content types for JSON requests ([#378]) - **fixed:** Support deserializing `i128` and `u128` in `extract::Path` @@ -155,6 +157,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#408]: https://github.com/tokio-rs/axum/pull/408 [#412]: https://github.com/tokio-rs/axum/pull/412 [#416]: https://github.com/tokio-rs/axum/pull/416 +[#428]: https://github.com/tokio-rs/axum/pull/428 +[proxy]: https://github.com/tokio-rs/axum/blob/main/examples/http-proxy/src/main.rs # 0.2.8 (07. October, 2021) diff --git a/src/routing/handler_method_router.rs b/src/routing/handler_method_router.rs index 74cab644..fcae7a38 100644 --- a/src/routing/handler_method_router.rs +++ b/src/routing/handler_method_router.rs @@ -64,16 +64,6 @@ where on(MethodFilter::all(), handler) } -/// Route `CONNECT` requests to the given handler. -/// -/// See [`get`] for an example. -pub fn connect(handler: H) -> MethodRouter -where - H: Handler, -{ - on(MethodFilter::CONNECT, handler) -} - /// Route `DELETE` requests to the given handler. /// /// See [`get`] for an example. @@ -261,16 +251,6 @@ impl MethodRouter { self.on(MethodFilter::all(), handler) } - /// Chain an additional handler that will only accept `CONNECT` requests. - /// - /// See [`MethodRouter::get`] for an example. - pub fn connect(self, handler: H2) -> MethodRouter - where - H2: Handler, - { - self.on(MethodFilter::CONNECT, handler) - } - /// Chain an additional handler that will only accept `DELETE` requests. /// /// See [`MethodRouter::get`] for an example. diff --git a/src/routing/method_filter.rs b/src/routing/method_filter.rs index d5da2cb5..251be637 100644 --- a/src/routing/method_filter.rs +++ b/src/routing/method_filter.rs @@ -4,8 +4,6 @@ use http::Method; bitflags! { /// A filter that matches one or more HTTP methods. pub struct MethodFilter: u16 { - /// Match `CONNECT` requests. - const CONNECT = 0b000000001; /// Match `DELETE` requests. const DELETE = 0b000000010; /// Match `GET` requests. @@ -29,7 +27,6 @@ impl MethodFilter { #[allow(clippy::match_like_matches_macro)] pub(crate) fn matches(self, method: &Method) -> bool { let method = match *method { - Method::CONNECT => Self::CONNECT, Method::DELETE => Self::DELETE, Method::GET => Self::GET, Method::HEAD => Self::HEAD, diff --git a/src/routing/mod.rs b/src/routing/mod.rs index 22ee12d5..f000162b 100644 --- a/src/routing/mod.rs +++ b/src/routing/mod.rs @@ -42,7 +42,7 @@ pub use self::{into_make_service::IntoMakeService, method_filter::MethodFilter, #[doc(no_inline)] pub use self::handler_method_router::{ - any, connect, delete, get, head, on, options, patch, post, put, trace, MethodRouter, + any, delete, get, head, on, options, patch, post, put, trace, MethodRouter, }; #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/src/routing/service_method_router.rs b/src/routing/service_method_router.rs index ab5f7579..940a1fc0 100644 --- a/src/routing/service_method_router.rs +++ b/src/routing/service_method_router.rs @@ -130,16 +130,6 @@ where on(MethodFilter::all(), svc) } -/// Route `CONNECT` requests to the given service. -/// -/// See [`get`] for an example. -pub fn connect(svc: S) -> MethodRouter, B> -where - S: Service> + Clone, -{ - on(MethodFilter::CONNECT, svc) -} - /// Route `DELETE` requests to the given service. /// /// See [`get`] for an example. @@ -319,16 +309,6 @@ impl MethodRouter { self.on(MethodFilter::all(), svc) } - /// Chain an additional service that will only accept `CONNECT` requests. - /// - /// See [`MethodRouter::get`] for an example. - pub fn connect(self, svc: T) -> MethodRouter - where - T: Service> + Clone, - { - self.on(MethodFilter::CONNECT, svc) - } - /// Chain an additional service that will only accept `DELETE` requests. /// /// See [`MethodRouter::get`] for an example.