Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add axum_extra::extract::Multipart #1692

Merged
merged 6 commits into from
Mar 3, 2023
Merged
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
4 changes: 3 additions & 1 deletion axum-extra/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning].

# Unreleased

- None.
- **added:** Add `Multipart`. This is similar to `axum::extract::Multipart`
except that it enforces field exclusivity at runtime instead of compile time,
as this improves usability.

# 0.6.0 (24. February, 2022)

Expand Down
3 changes: 3 additions & 0 deletions axum-extra/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ json-lines = [
"tokio-util?/io",
"tokio-stream?/io-util"
]
multipart = ["dep:multer"]
protobuf = ["dep:prost"]
query = ["dep:serde", "dep:serde_html_form"]
spa = ["tower-http/fs"]
Expand All @@ -51,6 +52,7 @@ tower-service = "0.3"
axum-macros = { path = "../axum-macros", version = "0.3.4", optional = true }
cookie = { package = "cookie", version = "0.17", features = ["percent-encode"], optional = true }
form_urlencoded = { version = "1.1.0", optional = true }
multer = { version = "2.0.0", optional = true }
percent-encoding = { version = "2.1", optional = true }
prost = { version = "0.11", optional = true }
serde = { version = "1.0", optional = true }
Expand All @@ -62,6 +64,7 @@ tokio-util = { version = "0.7", optional = true }
[dev-dependencies]
axum = { path = "../axum", version = "0.6.0", features = ["headers"] }
futures = "0.3"
http-body = "0.4.4"
hyper = "0.14"
reqwest = { version = "0.11", default-features = false, features = ["json", "stream", "multipart"] }
serde = { version = "1.0", features = ["derive"] }
Expand Down
6 changes: 6 additions & 0 deletions axum-extra/src/extract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ pub mod cookie;
#[cfg(feature = "query")]
mod query;

#[cfg(feature = "multipart")]
pub mod multipart;

mod with_rejection;

pub use self::cached::Cached;
Expand All @@ -30,6 +33,9 @@ pub use self::form::{Form, FormRejection};
#[cfg(feature = "query")]
pub use self::query::{Query, QueryRejection};

#[cfg(feature = "multipart")]
pub use self::multipart::Multipart;

#[cfg(feature = "json-lines")]
#[doc(no_inline)]
pub use crate::json_lines::JsonLines;
Expand Down
Loading