Create-http-urls.any.js (479B)
1 test(() => { 2 const url = new URL ("/", location); 3 url.protocol = "http"; 4 const httpURL = url.href; 5 url.protocol = "https"; 6 const httpsURL = url.href; 7 url.protocol = "ws"; 8 const wsURL = url.href; 9 url.protocol = "wss"; 10 const wssURL = url.href; 11 12 let ws = new WebSocket(httpURL); 13 assert_equals(ws.url, wsURL); 14 ws.close(); 15 16 ws = new WebSocket(httpsURL); 17 assert_equals(ws.url, wssURL); 18 ws.close(); 19 }, "WebSocket: ensure both HTTP schemes are supported");