dont remove all headers
This commit is contained in:
parent
6e8ff0294d
commit
5c29b1a0af
10
src/main.rs
10
src/main.rs
@ -177,13 +177,13 @@ async fn show_art(
|
|||||||
{
|
{
|
||||||
if agent.contains("Discordbot") {
|
if agent.contains("Discordbot") {
|
||||||
let request = state.http.get(&image_link).build()?;
|
let request = state.http.get(&image_link).build()?;
|
||||||
let mut resp = state.http.execute(request).await?.error_for_status()?;
|
let resp = state.http.execute(request).await?.error_for_status()?;
|
||||||
let content_type = resp.headers_mut().remove(http::header::CONTENT_TYPE);
|
let headers = resp.headers().clone();
|
||||||
let downloaded = resp.bytes().await?;
|
let downloaded = resp.bytes().await?;
|
||||||
let mut response = axum::response::Response::new(downloaded.into());
|
let mut response = axum::response::Response::new(downloaded.into());
|
||||||
if let Some(v) = content_type {
|
*response.headers_mut() = headers;
|
||||||
response.headers_mut().insert(http::header::CONTENT_TYPE, v);
|
response.headers_mut().remove(http::header::CACHE_CONTROL);
|
||||||
}
|
response.headers_mut().remove(http::header::CACHE_STATUS);
|
||||||
return Ok(response);
|
return Ok(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user