summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/websockets/basic-auth.any.js
blob: 9fbdc5d5cede4050d414bed45a3b8c55689c6c08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// META: global=window,worker
// META: script=constants.sub.js
// META: variant=?wss
// META: variant=?wpt_flags=h2

async_test(t => {
  const url = __SCHEME + '://' + 'foo:bar@' + __SERVER__NAME + ':' + __PORT + '/basic_auth';
  const ws = new WebSocket(url);
  ws.onopen = () => {
    ws.onclose = ws.onerror = null;
    ws.close();
    t.done();
  };
  ws.onerror = ws.onclose = t.unreached_func('open should succeed');
}, 'HTTP basic authentication should work with WebSockets');

done();