1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-26 10:27:42 +02:00

use forward_ready for service definitions

This commit is contained in:
Rob Ede
2021-03-22 05:18:59 +00:00
parent b0854ed144
commit 2254a429d4
9 changed files with 38 additions and 68 deletions

View File

@ -1,8 +1,4 @@
use std::{
convert::TryInto,
rc::Rc,
task::{Context, Poll},
};
use std::{convert::TryInto, rc::Rc};
use actix_web::{
dev::{Service, ServiceRequest, ServiceResponse},
@ -131,9 +127,7 @@ where
type Error = Error;
type Future = CorsMiddlewareServiceFuture<B>;
fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.service.poll_ready(cx)
}
actix_service::forward_ready!(service);
fn call(&self, req: ServiceRequest) -> Self::Future {
if self.inner.preflight && req.method() == Method::OPTIONS {