Skip to content

Commit

Permalink
feat: Downgrade reqwest to 0.11.20
Browse files Browse the repository at this point in the history
  • Loading branch information
bakjos committed Apr 3, 2024
1 parent 1a216c9 commit 5532961
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/meta/dashboard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ axum = "=0.7.4" # TODO: 0.7.5+ does not work with current toolchain
bytes = "1"
hyper = "1"
mime_guess = "2"
reqwest = "0.12.2"
reqwest = "0.11"
rust-embed = { version = "8", features = ["interpolate-folder-path", "mime-guess"] }
thiserror-ext = { workspace = true }
tracing = "0.1"
Expand Down
14 changes: 12 additions & 2 deletions src/meta/dashboard/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

use std::collections::HashMap;
use std::str::FromStr;
use std::sync::{Arc, Mutex};

use anyhow::anyhow;
Expand Down Expand Up @@ -87,8 +88,17 @@ async fn proxy(
let content = reqwest::get(url.clone()).await?;

let resp = CachedResponse {
code: content.status(),
headers: content.headers().clone(),
code: hyper::StatusCode::from_u16(content.status().as_u16()).unwrap(),
headers: content.headers().iter().fold(
hyper::HeaderMap::with_capacity(content.headers().len()),
|mut header, it| {
header.insert(
hyper::header::HeaderName::from_str(it.0.as_str()).unwrap(),
hyper::header::HeaderValue::from_bytes(it.1.as_bytes()).unwrap(),
);
header
},
),
body: content.bytes().await?,
uri: url,
};
Expand Down

0 comments on commit 5532961

Please sign in to comment.