diff --git a/Cargo.lock b/Cargo.lock index 58d4803d..aefdc16d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2288,6 +2288,7 @@ dependencies = [ "serde_json", "tungstenite", "ureq", + "url", ] [[package]] diff --git a/test_client/Cargo.toml b/test_client/Cargo.toml index 00c2d843..e002f6bb 100644 --- a/test_client/Cargo.toml +++ b/test_client/Cargo.toml @@ -11,4 +11,5 @@ ureq = "2" flexi_logger = { version = "0.23.1", features = ["colors"] } log = "0.4" base64 = "0.13" -miette = { version = "3", features = ["fancy"] } \ No newline at end of file +miette = { version = "3", features = ["fancy"] } +url = "2.2.2" \ No newline at end of file diff --git a/test_client/src/main.rs b/test_client/src/main.rs index 75909a93..c9e71a30 100644 --- a/test_client/src/main.rs +++ b/test_client/src/main.rs @@ -3,8 +3,8 @@ use log::{debug, info, trace, warn}; use miette::{IntoDiagnostic, Report, Result, WrapErr}; use serde_json::Value; use std::env::var; -use tungstenite::http::Request; use tungstenite::{connect, Message}; +use url::Url; fn main() -> Result<()> { Logger::try_with_str(&var("LOG").unwrap_or_else(|_| String::from("test_client=info,warn"))) @@ -28,11 +28,10 @@ fn main() -> Result<()> { let ws_url = get_endpoint(&nc_url, &username, &password)?; info!("Found push server at {}", ws_url); - let ws_request = Request::get(ws_url) - .body(()) + let ws_url = Url::parse(&ws_url) .into_diagnostic() .wrap_err("Invalid websocket url")?; - let (mut socket, _response) = connect(ws_request) + let (mut socket, _response) = connect(ws_url) .into_diagnostic() .wrap_err("Can't connect to server")?;