mirror of
https://gitlab.com/news-flash/article_scraper.git
synced 2025-07-07 16:15:32 +02:00
print url
This commit is contained in:
parent
40f065d9cd
commit
eb1bfdbca0
1 changed files with 13 additions and 10 deletions
|
@ -1193,7 +1193,7 @@ impl Util {
|
|||
let status_code = response.status();
|
||||
|
||||
if !status_code.is_success() {
|
||||
log::warn!("response: {status_code}");
|
||||
log::warn!("response: {status_code} ({})", response.url());
|
||||
return Err(ImageDownloadError::Http);
|
||||
}
|
||||
|
||||
|
@ -1206,16 +1206,19 @@ impl Util {
|
|||
}
|
||||
|
||||
pub fn get_content_type(response: &Response) -> Result<String, ImageDownloadError> {
|
||||
if response.status().is_success() {
|
||||
response
|
||||
.headers()
|
||||
.get(CONTENT_TYPE)
|
||||
.and_then(|val| val.to_str().ok())
|
||||
.map(|val| val.to_string())
|
||||
.ok_or(ImageDownloadError::ContentType)
|
||||
} else {
|
||||
Err(ImageDownloadError::ContentType)
|
||||
let status_code = response.status();
|
||||
|
||||
if !status_code.is_success() {
|
||||
log::warn!("response: {status_code} ({})", response.url());
|
||||
return Err(ImageDownloadError::Http);
|
||||
}
|
||||
|
||||
response
|
||||
.headers()
|
||||
.get(CONTENT_TYPE)
|
||||
.and_then(|val| val.to_str().ok())
|
||||
.map(|val| val.to_string())
|
||||
.ok_or(ImageDownloadError::ContentType)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue