Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /websockets/basic-auth.any.html?wpt_flags=h2 - WPT Dashboard Interop Dashboard
- /websockets/basic-auth.any.html?wss - WPT Dashboard Interop Dashboard
- /websockets/basic-auth.any.serviceworker.html?wpt_flags=h2 - WPT Dashboard Interop Dashboard
- /websockets/basic-auth.any.serviceworker.html?wss - WPT Dashboard Interop Dashboard
- /websockets/basic-auth.any.sharedworker.html?wpt_flags=h2 - WPT Dashboard Interop Dashboard
- /websockets/basic-auth.any.sharedworker.html?wss - WPT Dashboard Interop Dashboard
- /websockets/basic-auth.any.worker.html?wpt_flags=h2 - WPT Dashboard Interop Dashboard
- /websockets/basic-auth.any.worker.html?wss - WPT Dashboard Interop Dashboard
// 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();