mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-01 00:50:32 +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"
|
||||
|
||||
[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"]
|
||||
http2 = ["hyper/http2"]
|
||||
json = ["serde_json"]
|
||||
matched-path = []
|
||||
multipart = ["multer"]
|
||||
original-uri = []
|
||||
query = ["serde_urlencoded"]
|
||||
tower-log = ["tower/log"]
|
||||
ws = ["tokio-tungstenite", "sha-1", "base64"]
|
||||
|
||||
|
@ -37,7 +39,6 @@ mime = "0.3.16"
|
|||
percent-encoding = "2.1"
|
||||
pin-project-lite = "0.2.7"
|
||||
serde = "1.0"
|
||||
serde_urlencoded = "0.7"
|
||||
sync_wrapper = "0.1.1"
|
||||
tokio = { version = "1", features = ["time"] }
|
||||
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" }
|
||||
multer = { optional = true, version = "2.0.0" }
|
||||
serde_json = { version = "1.0", optional = true, features = ["raw_value"] }
|
||||
serde_urlencoded = { version = "0.7", optional = true }
|
||||
sha-1 = { optional = true, version = "0.10" }
|
||||
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.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "form")))]
|
||||
#[derive(Debug, Clone, Copy, Default)]
|
||||
pub struct Form<T>(pub T);
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ pub mod ws;
|
|||
|
||||
mod content_length_limit;
|
||||
mod extension;
|
||||
mod form;
|
||||
mod query;
|
||||
mod raw_query;
|
||||
mod request_parts;
|
||||
|
||||
|
@ -28,16 +26,22 @@ pub use self::{
|
|||
content_length_limit::ContentLengthLimit,
|
||||
extension::Extension,
|
||||
extractor_middleware::extractor_middleware,
|
||||
form::Form,
|
||||
path::Path,
|
||||
query::Query,
|
||||
raw_query::RawQuery,
|
||||
request_parts::{BodyStream, RawBody},
|
||||
};
|
||||
|
||||
#[doc(no_inline)]
|
||||
#[cfg(feature = "json")]
|
||||
pub use crate::Json;
|
||||
|
||||
#[cfg(feature = "form")]
|
||||
mod form;
|
||||
|
||||
#[cfg(feature = "form")]
|
||||
#[doc(inline)]
|
||||
pub use self::form::Form;
|
||||
|
||||
#[cfg(feature = "matched-path")]
|
||||
mod matched_path;
|
||||
|
||||
|
@ -52,6 +56,13 @@ pub mod multipart;
|
|||
#[doc(inline)]
|
||||
pub use self::multipart::Multipart;
|
||||
|
||||
#[cfg(feature = "query")]
|
||||
mod query;
|
||||
|
||||
#[cfg(feature = "query")]
|
||||
#[doc(inline)]
|
||||
pub use self::query::Query;
|
||||
|
||||
#[cfg(feature = "original-uri")]
|
||||
#[doc(inline)]
|
||||
pub use self::request_parts::OriginalUri;
|
||||
|
|
|
@ -44,6 +44,7 @@ use std::ops::Deref;
|
|||
/// example.
|
||||
///
|
||||
/// [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)]
|
||||
pub struct Query<T>(pub T);
|
||||
|
||||
|
|
Loading…
Reference in a new issue