mirror of
https://github.com/tokio-rs/axum.git
synced 2025-03-20 14:08:51 +01:00
Relax Multipart FromRequest implementation bounds (#1379)
This commit is contained in:
parent
7476dd08cb
commit
c8dbe5a7e9
1 changed files with 9 additions and 2 deletions
|
@ -59,7 +59,8 @@ pub struct Multipart {
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<S, B> FromRequest<S, B> for Multipart
|
impl<S, B> FromRequest<S, B> for Multipart
|
||||||
where
|
where
|
||||||
B: HttpBody<Data = Bytes> + Default + Unpin + Send + 'static,
|
B: HttpBody + Send + 'static,
|
||||||
|
B::Data: Into<Bytes>,
|
||||||
B::Error: Into<BoxError>,
|
B::Error: Into<BoxError>,
|
||||||
S: Send + Sync,
|
S: Send + Sync,
|
||||||
{
|
{
|
||||||
|
@ -248,7 +249,7 @@ define_rejection! {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{response::IntoResponse, routing::post, test_helpers::*, Router};
|
use crate::{body::Body, response::IntoResponse, routing::post, test_helpers::*, Router};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn content_type_with_encoding() {
|
async fn content_type_with_encoding() {
|
||||||
|
@ -280,4 +281,10 @@ mod tests {
|
||||||
|
|
||||||
client.post("/").multipart(form).send().await;
|
client.post("/").multipart(form).send().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No need for this to be a #[test], we just want to make sure it compiles
|
||||||
|
fn _multipart_from_request_limited() {
|
||||||
|
async fn handler(_: Multipart) {}
|
||||||
|
let _app: Router<(), http_body::Limited<Body>> = Router::new().route("/", post(handler));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue