Skip to content

Commit

Permalink
address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
neonphog committed Apr 23, 2024
1 parent 5c74530 commit 4cd0be1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rust/sbd-client/src/raw_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ impl WsRawConnect {
danger_disable_certificate_check,
} = self;

let scheme_ws = full_url.starts_with("ws://");
let scheme_wss = full_url.starts_with("wss://");
let request = tokio_tungstenite::tungstenite::client::IntoClientRequest::into_client_request(full_url).map_err(Error::other)?;

let scheme_ws = request.uri().scheme_str() == Some("ws");
let scheme_wss = request.uri().scheme_str() == Some("wss");

if !scheme_ws && !scheme_wss {
return Err(Error::other("scheme must be ws:// or wss://"));
Expand All @@ -42,8 +44,6 @@ impl WsRawConnect {
return Err(Error::other("plain text scheme not allowed"));
}

let request = tokio_tungstenite::tungstenite::client::IntoClientRequest::into_client_request(full_url).map_err(Error::other)?;

let host = match request.uri().host() {
Some(host) => host.to_string(),
None => return Err(Error::other("invalid url")),
Expand Down

0 comments on commit 4cd0be1

Please sign in to comment.