Skip to content

Commit

Permalink
fix test client not being able to connect
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Oct 25, 2022
1 parent fc56ee4 commit 03aa38d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion test_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
miette = { version = "3", features = ["fancy"] }
url = "2.2.2"
7 changes: 3 additions & 4 deletions test_client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand All @@ -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")?;

Expand Down

0 comments on commit 03aa38d

Please sign in to comment.