mirror of
https://github.com/actix/actix-web.git
synced 2024-12-18 22:26:37 +00:00
minor syntax update
This commit is contained in:
parent
2e883cf44f
commit
7f113ef9e4
1 changed files with 24 additions and 22 deletions
|
@ -200,13 +200,16 @@ where
|
||||||
return Ok(middleware::Response::Done(res));
|
return Ok(middleware::Response::Done(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
let e = if let Body::Binary(b) = res.body() {
|
// This double match is because we can't do the return in the first match
|
||||||
Some(EntityTag::strong(self.hasher.hash(b.as_ref())))
|
// as res is still borrowed
|
||||||
} else {
|
let etag = match match res.body() {
|
||||||
None
|
Body::Binary(b) => Some(EntityTag::strong(self.hasher.hash(b.as_ref()))),
|
||||||
|
_ => None,
|
||||||
|
} {
|
||||||
|
Some(tag) => tag,
|
||||||
|
None => return Ok(middleware::Response::Done(res)),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(etag) = e {
|
|
||||||
if !none_match(&etag, req) {
|
if !none_match(&etag, req) {
|
||||||
let mut not_modified =
|
let mut not_modified =
|
||||||
HttpResponse::NotModified().set(header::ETag(etag)).finish();
|
HttpResponse::NotModified().set(header::ETag(etag)).finish();
|
||||||
|
@ -226,7 +229,6 @@ where
|
||||||
res.headers_mut().insert(header::ETAG, v);
|
res.headers_mut().insert(header::ETAG, v);
|
||||||
})
|
})
|
||||||
.unwrap_or(());
|
.unwrap_or(());
|
||||||
}
|
|
||||||
Ok(middleware::Response::Done(res))
|
Ok(middleware::Response::Done(res))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue