mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-03 17:52:18 +01:00
Put the Form and Query extractors behind (default-on) Cargo features (#775)
* Put the Form extractor behind a (default-activated) Cargo feature * Put the Query behind a (default-activated) Cargo feature
This commit is contained in:
parent
4473efd1e6
commit
89e9d1bff1
4 changed files with 21 additions and 6 deletions
|
@ -11,13 +11,15 @@ readme = "README.md"
|
||||||
repository = "https://github.com/tokio-rs/axum"
|
repository = "https://github.com/tokio-rs/axum"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["http1", "json", "matched-path", "original-uri", "tower-log"]
|
default = ["form", "http1", "json", "matched-path", "original-uri", "query", "tower-log"]
|
||||||
|
form = ["serde_urlencoded"]
|
||||||
http1 = ["hyper/http1"]
|
http1 = ["hyper/http1"]
|
||||||
http2 = ["hyper/http2"]
|
http2 = ["hyper/http2"]
|
||||||
json = ["serde_json"]
|
json = ["serde_json"]
|
||||||
matched-path = []
|
matched-path = []
|
||||||
multipart = ["multer"]
|
multipart = ["multer"]
|
||||||
original-uri = []
|
original-uri = []
|
||||||
|
query = ["serde_urlencoded"]
|
||||||
tower-log = ["tower/log"]
|
tower-log = ["tower/log"]
|
||||||
ws = ["tokio-tungstenite", "sha-1", "base64"]
|
ws = ["tokio-tungstenite", "sha-1", "base64"]
|
||||||
|
|
||||||
|
@ -37,7 +39,6 @@ mime = "0.3.16"
|
||||||
percent-encoding = "2.1"
|
percent-encoding = "2.1"
|
||||||
pin-project-lite = "0.2.7"
|
pin-project-lite = "0.2.7"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_urlencoded = "0.7"
|
|
||||||
sync_wrapper = "0.1.1"
|
sync_wrapper = "0.1.1"
|
||||||
tokio = { version = "1", features = ["time"] }
|
tokio = { version = "1", features = ["time"] }
|
||||||
tower = { version = "0.4.11", default-features = false, features = ["util", "buffer", "make"] }
|
tower = { version = "0.4.11", default-features = false, features = ["util", "buffer", "make"] }
|
||||||
|
@ -50,6 +51,7 @@ base64 = { optional = true, version = "0.13" }
|
||||||
headers = { optional = true, version = "0.3" }
|
headers = { optional = true, version = "0.3" }
|
||||||
multer = { optional = true, version = "2.0.0" }
|
multer = { optional = true, version = "2.0.0" }
|
||||||
serde_json = { version = "1.0", optional = true, features = ["raw_value"] }
|
serde_json = { version = "1.0", optional = true, features = ["raw_value"] }
|
||||||
|
serde_urlencoded = { version = "0.7", optional = true }
|
||||||
sha-1 = { optional = true, version = "0.10" }
|
sha-1 = { optional = true, version = "0.10" }
|
||||||
tokio-tungstenite = { optional = true, version = "0.16" }
|
tokio-tungstenite = { optional = true, version = "0.16" }
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ use std::ops::Deref;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note that `Content-Type: multipart/form-data` requests are not supported.
|
/// Note that `Content-Type: multipart/form-data` requests are not supported.
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "form")))]
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
pub struct Form<T>(pub T);
|
pub struct Form<T>(pub T);
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@ pub mod ws;
|
||||||
|
|
||||||
mod content_length_limit;
|
mod content_length_limit;
|
||||||
mod extension;
|
mod extension;
|
||||||
mod form;
|
|
||||||
mod query;
|
|
||||||
mod raw_query;
|
mod raw_query;
|
||||||
mod request_parts;
|
mod request_parts;
|
||||||
|
|
||||||
|
@ -28,16 +26,22 @@ pub use self::{
|
||||||
content_length_limit::ContentLengthLimit,
|
content_length_limit::ContentLengthLimit,
|
||||||
extension::Extension,
|
extension::Extension,
|
||||||
extractor_middleware::extractor_middleware,
|
extractor_middleware::extractor_middleware,
|
||||||
form::Form,
|
|
||||||
path::Path,
|
path::Path,
|
||||||
query::Query,
|
|
||||||
raw_query::RawQuery,
|
raw_query::RawQuery,
|
||||||
request_parts::{BodyStream, RawBody},
|
request_parts::{BodyStream, RawBody},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
#[cfg(feature = "json")]
|
#[cfg(feature = "json")]
|
||||||
pub use crate::Json;
|
pub use crate::Json;
|
||||||
|
|
||||||
|
#[cfg(feature = "form")]
|
||||||
|
mod form;
|
||||||
|
|
||||||
|
#[cfg(feature = "form")]
|
||||||
|
#[doc(inline)]
|
||||||
|
pub use self::form::Form;
|
||||||
|
|
||||||
#[cfg(feature = "matched-path")]
|
#[cfg(feature = "matched-path")]
|
||||||
mod matched_path;
|
mod matched_path;
|
||||||
|
|
||||||
|
@ -52,6 +56,13 @@ pub mod multipart;
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use self::multipart::Multipart;
|
pub use self::multipart::Multipart;
|
||||||
|
|
||||||
|
#[cfg(feature = "query")]
|
||||||
|
mod query;
|
||||||
|
|
||||||
|
#[cfg(feature = "query")]
|
||||||
|
#[doc(inline)]
|
||||||
|
pub use self::query::Query;
|
||||||
|
|
||||||
#[cfg(feature = "original-uri")]
|
#[cfg(feature = "original-uri")]
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use self::request_parts::OriginalUri;
|
pub use self::request_parts::OriginalUri;
|
||||||
|
|
|
@ -44,6 +44,7 @@ use std::ops::Deref;
|
||||||
/// example.
|
/// example.
|
||||||
///
|
///
|
||||||
/// [example]: https://github.com/tokio-rs/axum/blob/main/examples/query-params-with-empty-strings/src/main.rs
|
/// [example]: https://github.com/tokio-rs/axum/blob/main/examples/query-params-with-empty-strings/src/main.rs
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "query")))]
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
pub struct Query<T>(pub T);
|
pub struct Query<T>(pub T);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue