1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

use objects pool for HttpRequest; optimize nested services call

This commit is contained in:
Nikolay Kim
2019-04-07 23:06:21 -07:00
parent 75b213a6f0
commit aa78565453
20 changed files with 343 additions and 295 deletions

View File

@ -423,7 +423,7 @@ impl<P> FilesService<P> {
> {
log::debug!("Files: Failed to handle {}: {}", req.path(), e);
if let Some(ref mut default) = self.default {
Either::B(default.call(ServiceRequest::from_parts(req, payload)))
default.call(ServiceRequest::from_parts(req, payload))
} else {
Either::A(ok(ServiceResponse::from_err(e, req.clone())))
}
@ -955,6 +955,7 @@ mod tests {
.method(Method::POST)
.to_http_request();
let resp = file.respond_to(&req).unwrap();
println!("RES: {:?}", resp);
assert_eq!(resp.status(), StatusCode::METHOD_NOT_ALLOWED);
let file = NamedFile::open("Cargo.toml").unwrap();