Relax Multipart FromRequest implementation bounds (#1379)

This commit is contained in:
Jonas Platte 2022-09-16 20:49:42 +02:00 committed by GitHub
parent 7476dd08cb
commit c8dbe5a7e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,7 +59,8 @@ pub struct Multipart {
#[async_trait]
impl<S, B> FromRequest<S, B> for Multipart
where
B: HttpBody<Data = Bytes> + Default + Unpin + Send + 'static,
B: HttpBody + Send + 'static,
B::Data: Into<Bytes>,
B::Error: Into<BoxError>,
S: Send + Sync,
{
@ -248,7 +249,7 @@ define_rejection! {
#[cfg(test)]
mod tests {
use super::*;
use crate::{response::IntoResponse, routing::post, test_helpers::*, Router};
use crate::{body::Body, response::IntoResponse, routing::post, test_helpers::*, Router};
#[tokio::test]
async fn content_type_with_encoding() {
@ -280,4 +281,10 @@ mod tests {
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));
}
}