<!DOCTYPE html>
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/get-request-header.js"></script>
<script>
description('Make sure handshake with credentials in URL is successful.');
window.jsTestIsAsync = true;
var url = 'ws://user:[email protected]:8880/echo-request-headers';
var host;
var ws = new WebSocket(url);
ws.onmessage = function (evt) {
host = getRequestHeaderFromEvent(evt, 'host');
shouldBeEqualToString('host', '127.0.0.1:8880');
finishJSTest();
};
ws.onclose = function (evt) {
testFailed('Unexpected close event ' + JSON.stringify(evt));
finishJSTest();
};
</script>