mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Uses and_then
instead of more complicated matching
This commit is contained in:
parent
84ae53e011
commit
1811ffa178
1 changed files with 12 additions and 12 deletions
|
@ -124,8 +124,9 @@ pub trait HttpResponse: Read {
|
||||||
fn status_raw(&self) -> &RawStatus;
|
fn status_raw(&self) -> &RawStatus;
|
||||||
|
|
||||||
fn content_encoding(&self) -> Option<Encoding> {
|
fn content_encoding(&self) -> Option<Encoding> {
|
||||||
match self.headers().get::<ContentEncoding>() {
|
self.headers().get::<ContentEncoding>().and_then(|h| {
|
||||||
Some(&ContentEncoding(ref encodings)) => {
|
match h {
|
||||||
|
&ContentEncoding(ref encodings) => {
|
||||||
if encodings.contains(&Encoding::Gzip) {
|
if encodings.contains(&Encoding::Gzip) {
|
||||||
Some(Encoding::Gzip)
|
Some(Encoding::Gzip)
|
||||||
} else if encodings.contains(&Encoding::Deflate) {
|
} else if encodings.contains(&Encoding::Deflate) {
|
||||||
|
@ -135,9 +136,8 @@ pub trait HttpResponse: Read {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
None => None
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue