1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

use sync method on Responder trait (#1891)

This commit is contained in:
fakeshadow
2021-01-09 06:17:19 +08:00
committed by GitHub
parent 2204614134
commit d40ae8c8ca
10 changed files with 221 additions and 300 deletions

View File

@@ -120,10 +120,8 @@ impl Service<ServiceRequest> for FilesService {
named_file.flags = self.file_flags;
let (req, _) = req.into_parts();
Either::Left(ok(match named_file.into_response(&req) {
Ok(item) => ServiceResponse::new(req, item),
Err(e) => ServiceResponse::from_err(e, req),
}))
let res = named_file.into_response(&req);
Either::Left(ok(ServiceResponse::new(req, res)))
}
Err(e) => self.handle_err(e, req),
}
@@ -154,12 +152,8 @@ impl Service<ServiceRequest> for FilesService {
named_file.flags = self.file_flags;
let (req, _) = req.into_parts();
match named_file.into_response(&req) {
Ok(item) => {
Either::Left(ok(ServiceResponse::new(req.clone(), item)))
}
Err(e) => Either::Left(ok(ServiceResponse::from_err(e, req))),
}
let res = named_file.into_response(&req);
Either::Left(ok(ServiceResponse::new(req, res)))
}
Err(e) => self.handle_err(e, req),
}