Update to actix-web 4 beta 3
This commit is contained in:
parent
839ba65ee9
commit
9cc2cea743
11
Cargo.toml
11
Cargo.toml
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "actix-form-data"
|
name = "actix-form-data"
|
||||||
description = "Multipart Form Data for Actix Web"
|
description = "Multipart Form Data for Actix Web"
|
||||||
version = "0.5.0"
|
version = "0.6.0-beta.1"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
repository = "https://git.asonix.dog/Aardwolf/actix-form-data.git"
|
repository = "https://git.asonix.dog/Aardwolf/actix-form-data.git"
|
||||||
|
@ -10,14 +10,13 @@ keywords = ["actix", "form-data", "multipart", "async"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-multipart = "0.3.0"
|
actix-multipart = "0.4.0-beta.2"
|
||||||
actix-rt = "1.1.1"
|
actix-rt = "2.0.2"
|
||||||
actix-web = "3.0.1"
|
actix-web = "4.0.0-beta.3"
|
||||||
bytes = "0.5.0"
|
|
||||||
futures = "0.3.4"
|
futures = "0.3.4"
|
||||||
mime = "0.3.16"
|
mime = "0.3.16"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tokio = { version = "0.2.21", features = ["sync"] }
|
tokio = { version = "1", features = ["sync"] }
|
||||||
tracing = "0.1.15"
|
tracing = "0.1.15"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -2,10 +2,9 @@ use actix_form_data::{Error, Field, Form, Value};
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
http::StatusCode,
|
http::StatusCode,
|
||||||
middleware::Logger,
|
middleware::Logger,
|
||||||
web::{post, resource},
|
web::{post, resource, Bytes},
|
||||||
App, HttpResponse, HttpServer, ResponseError,
|
App, HttpResponse, HttpServer, ResponseError,
|
||||||
};
|
};
|
||||||
use bytes::Bytes;
|
|
||||||
use futures::stream::{Stream, StreamExt, TryStreamExt};
|
use futures::stream::{Stream, StreamExt, TryStreamExt};
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
|
|
|
@ -58,12 +58,11 @@ impl FromRequest for Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> Transform<S> for Form
|
impl<S> Transform<S, ServiceRequest> for Form
|
||||||
where
|
where
|
||||||
S: Service<Request = ServiceRequest, Error = actix_web::Error>,
|
S: Service<ServiceRequest, Error = actix_web::Error>,
|
||||||
S::Future: 'static,
|
S::Future: 'static,
|
||||||
{
|
{
|
||||||
type Request = S::Request;
|
|
||||||
type Response = S::Response;
|
type Response = S::Response;
|
||||||
type Error = S::Error;
|
type Error = S::Error;
|
||||||
type InitError = ();
|
type InitError = ();
|
||||||
|
@ -78,21 +77,20 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> Service for MultipartMiddleware<S>
|
impl<S> Service<ServiceRequest> for MultipartMiddleware<S>
|
||||||
where
|
where
|
||||||
S: Service<Request = ServiceRequest, Error = actix_web::Error>,
|
S: Service<ServiceRequest, Error = actix_web::Error>,
|
||||||
S::Future: 'static,
|
S::Future: 'static,
|
||||||
{
|
{
|
||||||
type Request = S::Request;
|
|
||||||
type Response = S::Response;
|
type Response = S::Response;
|
||||||
type Error = S::Error;
|
type Error = S::Error;
|
||||||
type Future = Pin<Box<dyn Future<Output = Result<S::Response, S::Error>>>>;
|
type Future = Pin<Box<dyn Future<Output = Result<S::Response, S::Error>>>>;
|
||||||
|
|
||||||
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
self.service.poll_ready(cx)
|
self.service.poll_ready(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(&mut self, mut req: S::Request) -> Self::Future {
|
fn call(&self, mut req: ServiceRequest) -> Self::Future {
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
req.extensions_mut().insert(Uploaded { rx });
|
req.extensions_mut().insert(Uploaded { rx });
|
||||||
let payload = req.take_payload();
|
let payload = req.take_payload();
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use bytes::Bytes;
|
use actix_web::web::Bytes;
|
||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
use mime::Mime;
|
use mime::Mime;
|
||||||
use std::{
|
use std::{
|
||||||
|
|
|
@ -24,7 +24,7 @@ use crate::{
|
||||||
MultipartForm, MultipartHash, NamePart, Value,
|
MultipartForm, MultipartHash, NamePart, Value,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use bytes::BytesMut;
|
use actix_web::web::BytesMut;
|
||||||
use futures::{
|
use futures::{
|
||||||
select,
|
select,
|
||||||
stream::{FuturesUnordered, StreamExt},
|
stream::{FuturesUnordered, StreamExt},
|
||||||
|
|
Loading…
Reference in a new issue