mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Flatten implementation of net::http_response::HttpResponse
.
This commit is contained in:
parent
50c6d937a5
commit
12dfe6ff28
1 changed files with 13 additions and 13 deletions
|
@ -198,19 +198,19 @@ pub trait HttpResponse: Read {
|
|||
"HTTP/1.1".to_owned()
|
||||
}
|
||||
fn content_encoding(&self) -> Option<Encoding> {
|
||||
self.headers().get::<ContentEncoding>().and_then(|h| {
|
||||
match *h {
|
||||
ContentEncoding(ref encodings) => {
|
||||
if encodings.contains(&Encoding::Gzip) {
|
||||
Some(Encoding::Gzip)
|
||||
} else if encodings.contains(&Encoding::Deflate) {
|
||||
Some(Encoding::Deflate)
|
||||
} else if encodings.contains(&Encoding::EncodingExt("br".to_owned())) {
|
||||
Some(Encoding::EncodingExt("br".to_owned()))
|
||||
} else { None }
|
||||
}
|
||||
}
|
||||
})
|
||||
let encodings = match self.headers().get::<ContentEncoding>() {
|
||||
Some(&ContentEncoding(ref encodings)) => encodings,
|
||||
None => return None,
|
||||
};
|
||||
if encodings.contains(&Encoding::Gzip) {
|
||||
Some(Encoding::Gzip)
|
||||
} else if encodings.contains(&Encoding::Deflate) {
|
||||
Some(Encoding::Deflate)
|
||||
} else if encodings.contains(&Encoding::EncodingExt("br".to_owned())) {
|
||||
Some(Encoding::EncodingExt("br".to_owned()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue