Skip to content

Commit

Permalink
add cfg feature
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolay-komarevskiy committed May 30, 2024
1 parent 37735b9 commit e2e2674
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion ic-agent/src/agent/agent_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use futures_util::FutureExt;
use ic_certification::{Delegation, Label};
use ic_transport_types::{NodeSignature, QueryResponse, RejectCode, RejectResponse, ReplyResponse};
use reqwest::Client;
use std::sync::Arc;
use std::{collections::BTreeMap, time::Duration};
use std::{collections::VecDeque, sync::Arc};
#[cfg(all(target_family = "wasm", feature = "wasm-bindgen"))]
use wasm_bindgen_test::wasm_bindgen_test;

Expand Down Expand Up @@ -50,6 +50,7 @@ fn make_agent_with_route_provider(
.unwrap()
}

#[cfg(feature = "hyper")]
fn make_agent_with_hyper_transport_route_provider(
route_provider: Arc<dyn RouteProvider>,
tcp_retries: usize,
Expand All @@ -61,6 +62,7 @@ fn make_agent_with_hyper_transport_route_provider(
client::legacy::{connect::HttpConnector, Client as LegacyClient},
rt::TokioExecutor,
};
use std::collections::VecDeque;

let connector = HttpsConnectorBuilder::new()
.with_webpki_roots()
Expand Down Expand Up @@ -382,6 +384,7 @@ async fn reqwest_client_status_okay_when_request_retried() -> Result<(), AgentEr
}

#[cfg_attr(not(target_family = "wasm"), tokio::test)]
#[cfg(feature = "hyper")]
async fn hyper_client_status_okay_when_request_retried() -> Result<(), AgentError> {
let map = BTreeMap::new();
let response = serde_cbor::Value::Map(map);
Expand Down
6 changes: 3 additions & 3 deletions ic-agent/src/agent/http_transport/hyper_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ where
}

let create_request_with_generated_url = || -> Result<Request<_>, AgentError> {
let url = self.route_provider.route()?.join(&endpoint)?;
let url = self.route_provider.route()?.join(endpoint)?;
println!("{url}");
let http_request = Request::builder()
.method(&method)
Expand Down Expand Up @@ -305,8 +305,8 @@ where

fn status(&self) -> AgentFuture<Vec<u8>> {
Box::pin(async move {
let endpoint = &format!("status");
self.request(Method::GET, endpoint, None).await
let endpoint = "status".to_string();
self.request(Method::GET, &endpoint, None).await
})
}
}
Expand Down

0 comments on commit e2e2674

Please sign in to comment.