File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ impl WebSocket {
64
64
/// Response::error("never got a message echoed back :(", 500)
65
65
/// ```
66
66
pub async fn connect ( url : Url ) -> Result < WebSocket > {
67
- return WebSocket :: connect_with_protocols ( url, None ) . await ;
67
+ WebSocket :: connect_with_protocols ( url, None ) . await
68
68
}
69
69
70
70
/// Attempts to establish a [`WebSocket`] connection to the provided [`Url`] and protocol.
@@ -74,7 +74,10 @@ impl WebSocket {
74
74
/// let ws = WebSocket::connect_with_protocols("wss://echo.zeb.workers.dev/".parse()?, Some(vec!["GiggleBytes"])).await?;
75
75
///
76
76
/// ```
77
- pub async fn connect_with_protocols ( mut url : Url , protocols : Option < Vec < & str > > ) -> Result < WebSocket > {
77
+ pub async fn connect_with_protocols (
78
+ mut url : Url ,
79
+ protocols : Option < Vec < & str > > ,
80
+ ) -> Result < WebSocket > {
78
81
let scheme: String = match url. scheme ( ) {
79
82
"ws" => "http" . into ( ) ,
80
83
"wss" => "https" . into ( ) ,
@@ -91,7 +94,8 @@ impl WebSocket {
91
94
match protocols {
92
95
None => { }
93
96
Some ( v) => {
94
- req. headers_mut ( ) ?. set ( "Sec-WebSocket-Protocol" , v. join ( "," ) . as_str ( ) ) ?;
97
+ req. headers_mut ( ) ?
98
+ . set ( "Sec-WebSocket-Protocol" , v. join ( "," ) . as_str ( ) ) ?;
95
99
}
96
100
}
97
101
You can’t perform that action at this time.
0 commit comments