Skip to content

Commit

Permalink
fmt and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
kflansburg committed Feb 28, 2024
1 parent 591f870 commit 8f530e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions worker/src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl WebSocket {
/// Response::error("never got a message echoed back :(", 500)
/// ```
pub async fn connect(url: Url) -> Result<WebSocket> {
return WebSocket::connect_with_protocols(url, None).await;
WebSocket::connect_with_protocols(url, None).await
}

/// Attempts to establish a [`WebSocket`] connection to the provided [`Url`] and protocol.
Expand All @@ -74,7 +74,10 @@ impl WebSocket {
/// let ws = WebSocket::connect_with_protocols("wss://echo.zeb.workers.dev/".parse()?, Some(vec!["GiggleBytes"])).await?;
///
/// ```
pub async fn connect_with_protocols(mut url: Url, protocols: Option<Vec<&str>>) -> Result<WebSocket> {
pub async fn connect_with_protocols(
mut url: Url,
protocols: Option<Vec<&str>>,
) -> Result<WebSocket> {
let scheme: String = match url.scheme() {
"ws" => "http".into(),
"wss" => "https".into(),
Expand All @@ -91,7 +94,8 @@ impl WebSocket {
match protocols {
None => {}
Some(v) => {
req.headers_mut()?.set("Sec-WebSocket-Protocol", v.join(",").as_str())?;
req.headers_mut()?
.set("Sec-WebSocket-Protocol", v.join(",").as_str())?;
}
}

Expand Down

0 comments on commit 8f530e3

Please sign in to comment.