From 3341c50b6ae676cdc8f7b1c44221aa633f2bde68 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 3 Jun 2024 17:17:08 -0400 Subject: refactor: don't share `reqwest::HttpClient` across tokio runtimes (#24092) This also fixes several issues where we weren't properly creating http clients with the user's settings. --- cli/tools/registry/api.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'cli/tools/registry/api.rs') diff --git a/cli/tools/registry/api.rs b/cli/tools/registry/api.rs index de9b4a333..c7097267d 100644 --- a/cli/tools/registry/api.rs +++ b/cli/tools/registry/api.rs @@ -6,6 +6,8 @@ use deno_runtime::deno_fetch::reqwest; use lsp_types::Url; use serde::de::DeserializeOwned; +use crate::http_util::HttpClient; + #[derive(serde::Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateAuthorizationResponse { @@ -116,8 +118,8 @@ pub async fn parse_response( } pub async fn get_scope( - client: &reqwest::Client, - registry_api_url: &str, + client: &HttpClient, + registry_api_url: &Url, scope: &str, ) -> Result { let scope_url = format!("{}scopes/{}", registry_api_url, scope); @@ -126,7 +128,7 @@ pub async fn get_scope( } pub fn get_package_api_url( - registry_api_url: &str, + registry_api_url: &Url, scope: &str, package: &str, ) -> String { @@ -134,8 +136,8 @@ pub fn get_package_api_url( } pub async fn get_package( - client: &reqwest::Client, - registry_api_url: &str, + client: &HttpClient, + registry_api_url: &Url, scope: &str, package: &str, ) -> Result { -- cgit v1.2.3