bca6c274b12b886a0de8807aa395300654148de7
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / url-no-trailing-slash.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../js-test-resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <div id="description"></div>
8 <div id="console"></div>
9 <script type="text/javascript">
10 description("URL that doesn't have trailing slash should not emit empty Request-URI.");
11
12 window.jsTestIsAsync = true;
13
14 var url = "ws://127.0.0.1:8880";
15 var handshake_success = false;
16 var ws_location;
17
18 var ws = new WebSocket(url);
19 ws.onopen = function () {
20     debug("WebSocket is open");
21     handshake_success = true;
22 };
23 ws.onmessage = function (evt) {
24     ws_location = evt.data;
25     debug("received:" + ws_location);
26     ws.close();
27 };
28 ws.onclose = function () {
29     debug("WebSocket is closed");
30     shouldBeTrue("handshake_success");
31     shouldBe("ws_location", '"ws://127.0.0.1:8880/"');
32     finishJSTest();
33 };
34
35 </script>
36 <script src="../../../../js-test-resources/js-test-post.js"></script>
37 </body>
38 </html>