Update to actix-web 4.0.0-beta.3

This commit is contained in:
asonix
2021-02-10 18:00:11 -06:00
parent 1c813d917b
commit 43227d9852
12 changed files with 212 additions and 501 deletions
+6 -8
View File
@@ -32,13 +32,12 @@ impl ResponseError for DebugError {
}
}
impl<S> Transform<S> for DebugPayload
impl<S> Transform<S, ServiceRequest> for DebugPayload
where
S: Service<Request = ServiceRequest, Error = actix_web::Error>,
S: Service<ServiceRequest, Error = actix_web::Error>,
S::Future: 'static,
S::Error: 'static,
{
type Request = S::Request;
type Response = S::Response;
type Error = S::Error;
type InitError = ();
@@ -50,22 +49,21 @@ where
}
}
impl<S> Service for DebugPayloadMiddleware<S>
impl<S> Service<ServiceRequest> for DebugPayloadMiddleware<S>
where
S: Service<Request = ServiceRequest, Error = actix_web::Error>,
S: Service<ServiceRequest, Error = actix_web::Error>,
S::Future: 'static,
S::Error: 'static,
{
type Request = S::Request;
type Response = S::Response;
type Error = S::Error;
type Future = LocalBoxFuture<'static, 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.1.poll_ready(cx)
}
fn call(&mut self, mut req: S::Request) -> Self::Future {
fn call(&self, mut req: ServiceRequest) -> Self::Future {
if self.0 && req.method() == Method::POST {
let pl = req.take_payload();
req.set_payload(Payload::Stream(Box::pin(once(
+1 -1
View File
@@ -124,7 +124,7 @@ async fn do_verify(
Ok(()) as Result<(), MyError>
})
.await?;
.await??;
Ok(())
}