Review fixes

This commit is contained in:
Manish Goregaokar 2016-06-10 15:46:12 +05:30
parent 8b9479f8bf
commit 9deecd793c
No known key found for this signature in database
GPG key ID: 3BBF4D3E2EF79F98
11 changed files with 44 additions and 549 deletions

View file

@ -226,9 +226,13 @@ impl Response {
let mut metadata = if let Some(ref url) = self.url {
Metadata::default(url.clone())
} else {
return Err(NetworkError::Internal("No url found".to_string()));
return Err(NetworkError::Internal("No url found in response".to_string()));
};
if self.is_network_error() {
return Err(NetworkError::Internal("Cannot extract metadata from network error".to_string()));
}
metadata.set_content_type(match self.headers.get() {
Some(&ContentType(ref mime)) => Some(mime),
None => None