async-graphql/integrations/tide/tests/test_utils.rs
2020-10-15 11:52:15 +01:00

24 lines
511 B
Rust

use reqwest::Client;
use std::time::Duration;
pub fn find_listen_addr() -> &'static str {
Box::leak(
format!(
"http://{}",
std::net::TcpListener::bind("localhost:0")
.unwrap()
.local_addr()
.unwrap()
)
.into_boxed_str(),
)
}
pub fn client() -> Client {
Client::builder().no_proxy().build().unwrap()
}
pub async fn wait_server_ready() {
tokio::time::delay_for(Duration::from_millis(300)).await;
}