summaryrefslogtreecommitdiff
path: root/cli/tools/registry/api.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-06-03 17:17:08 -0400
committerGitHub <noreply@github.com>2024-06-03 21:17:08 +0000
commit3341c50b6ae676cdc8f7b1c44221aa633f2bde68 (patch)
treee051e384d722403ea0a04402679a358ef61002dc /cli/tools/registry/api.rs
parent72088f2f52d65b2948155a11e7b56722bf6c10f9 (diff)
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.
Diffstat (limited to 'cli/tools/registry/api.rs')
-rw-r--r--cli/tools/registry/api.rs12
1 files changed, 7 insertions, 5 deletions
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<T: DeserializeOwned>(
}
pub async fn get_scope(
- client: &reqwest::Client,
- registry_api_url: &str,
+ client: &HttpClient,
+ registry_api_url: &Url,
scope: &str,
) -> Result<reqwest::Response, AnyError> {
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<reqwest::Response, AnyError> {