mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
fix(cli/rt/websockets): Only add Sec-WebSocket-Protocol if it's not empty (#7936)
This commit is contained in:
parent
4b43f8cffa
commit
0a2f0fe7f2
2 changed files with 8 additions and 6 deletions
|
@ -68,11 +68,13 @@ pub async fn op_ws_create(
|
|||
cli_state.flags.ca_file.clone()
|
||||
};
|
||||
let uri: Uri = args.url.parse()?;
|
||||
let request = Request::builder()
|
||||
.method(Method::GET)
|
||||
.uri(&uri)
|
||||
.header("Sec-WebSocket-Protocol", args.protocols)
|
||||
.body(())?;
|
||||
let mut request = Request::builder().method(Method::GET).uri(&uri);
|
||||
|
||||
if !args.protocols.is_empty() {
|
||||
request = request.header("Sec-WebSocket-Protocol", args.protocols);
|
||||
}
|
||||
|
||||
let request = request.body(())?;
|
||||
let domain = &uri.host().unwrap().to_string();
|
||||
let port = &uri.port_u16().unwrap_or(match uri.scheme_str() {
|
||||
Some("wss") => 443,
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
core.jsonOpAsync("op_ws_create", {
|
||||
url: wsURL.href,
|
||||
protocols: protocols.join("; "),
|
||||
protocols: protocols.join(", "),
|
||||
}).then((create) => {
|
||||
if (create.success) {
|
||||
this.#rid = create.rid;
|
||||
|
|
Loading…
Reference in a new issue