mirror of
https://github.com/actix/actix-web.git
synced 2024-12-18 14:16:47 +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));
|
||||
}
|
||||
|
||||
let e = if let Body::Binary(b) = res.body() {
|
||||
Some(EntityTag::strong(self.hasher.hash(b.as_ref())))
|
||||
} else {
|
||||
None
|
||||
// This double match is because we can't do the return in the first match
|
||||
// as res is still borrowed
|
||||
let etag = match match res.body() {
|
||||
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) {
|
||||
let mut not_modified =
|
||||
HttpResponse::NotModified().set(header::ETag(etag)).finish();
|
||||
|
@ -226,7 +229,6 @@ where
|
|||
res.headers_mut().insert(header::ETAG, v);
|
||||
})
|
||||
.unwrap_or(());
|
||||
}
|
||||
Ok(middleware::Response::Done(res))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue