Browse Source

Remove stale references to reqwest

Cesar Rodas 5 ngày trước cách đây
mục cha
commit
8dc3d2d400

+ 8 - 9
crates/cdk-integration-tests/tests/fake_auth.rs

@@ -14,6 +14,7 @@ use cdk::nuts::{
 };
 use cdk::wallet::{AuthHttpClient, AuthMintConnector, HttpClient, MintConnector, WalletBuilder};
 use cdk::{Error, OidcClient};
+use cdk_common::HttpClient as CommonHttpClient;
 use cdk_fake_wallet::create_fake_invoice;
 use cdk_integration_tests::fund_wallet;
 use cdk_sqlite::wallet::memory;
@@ -774,15 +775,13 @@ async fn get_access_token(mint_info: &MintInfo) -> (String, String) {
     ];
 
     // Make the token request directly
-    let client = reqwest::Client::new();
-    let response = client
-        .post(token_url)
+    let client = CommonHttpClient::new();
+    let token_response: serde_json::Value = client
+        .post(&token_url)
         .form(&params)
         .send()
         .await
-        .expect("Failed to send token request");
-
-    let token_response: serde_json::Value = response
+        .expect("Failed to send token request")
         .json()
         .await
         .expect("Failed to parse token response");
@@ -831,15 +830,15 @@ async fn get_custom_access_token(
     ];
 
     // Make the token request directly
-    let client = reqwest::Client::new();
+    let client = CommonHttpClient::new();
     let response = client
-        .post(token_url)
+        .post(&token_url)
         .form(&params)
         .send()
         .await
         .map_err(|_| Error::Custom("Failed to send token request".to_string()))?;
 
-    if !response.status().is_success() {
+    if !response.is_success() {
         return Err(Error::Custom(format!(
             "Token request failed with status: {}",
             response.status()

+ 6 - 5
crates/cdk-integration-tests/tests/ldk_node.rs

@@ -1,4 +1,5 @@
 use anyhow::Result;
+use cdk_common::HttpClient;
 use cdk_integration_tests::get_mint_url_from_env;
 
 #[tokio::test]
@@ -7,10 +8,10 @@ async fn test_ldk_node_mint_info() -> Result<()> {
     let mint_url = get_mint_url_from_env();
 
     // Create an HTTP client
-    let client = reqwest::Client::new();
+    let client = HttpClient::new();
 
     // Make a request to the info endpoint
-    let response = client.get(format!("{}/v1/info", mint_url)).send().await?;
+    let response = client.get(&format!("{}/v1/info", mint_url)).send().await?;
 
     // Check that we got a successful response
     assert_eq!(response.status(), 200);
@@ -34,7 +35,7 @@ async fn test_ldk_node_mint_quote() -> Result<()> {
     let mint_url = get_mint_url_from_env();
 
     // Create an HTTP client
-    let client = reqwest::Client::new();
+    let client = HttpClient::new();
 
     // Create a mint quote request
     let quote_request = serde_json::json!({
@@ -44,7 +45,7 @@ async fn test_ldk_node_mint_quote() -> Result<()> {
 
     // Make a request to create a mint quote
     let response = client
-        .post(format!("{}/v1/mint/quote/bolt11", mint_url))
+        .post(&format!("{}/v1/mint/quote/bolt11", mint_url))
         .json(&quote_request)
         .send()
         .await?;
@@ -57,7 +58,7 @@ async fn test_ldk_node_mint_quote() -> Result<()> {
 
     // For now, we'll just check that we get a response (even if it's an error)
     // In a real test, we'd want to verify the quote was created correctly
-    assert!(status.is_success() || status.as_u16() < 500);
+    assert!(status < 300 || status < 500);
 
     Ok(())
 }