Skip to content

Commit

Permalink
Add axum_extra::extract::Multipart (#1692)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpdrsn authored Mar 3, 2023
1 parent 67befbc commit aa2cbf6
Show file tree
Hide file tree
Showing 5 changed files with 411 additions and 1 deletion.
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

0 comments on commit aa2cbf6

Please sign in to comment.