Commit ade5924a authored by Elias Nahum's avatar Elias Nahum Committed by Carlos Tadeu Panato Junior

If the websocket url is malformed do not attempt to connect (#559)

* If the websocket url is malformed do not attempt to connect

* Reject the WebSocket connection promise so it can be handled by the client
parent c3a72154
......@@ -88,7 +88,10 @@ class WebSocketClient {
}
} else {
// If we're unable to set the origin header, the websocket won't connect, but the URL is likely malformed anyway
console.warn('websocket failed to parse origin from ' + connectionUrl); // eslint-disable-line no-console
const errorMessage = 'websocket failed to parse origin from ' + connectionUrl;
console.warn(errorMessage); // eslint-disable-line no-console
reject(errorMessage);
return;
}
this.conn = new Socket(connectionUrl, [], {headers: {origin}, ...(additionalOptions || {})});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment