]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Test when origin contains a path.
authorKyle Kelley <kyle.kelley@rackspace.com>
Thu, 8 May 2014 18:53:11 +0000 (13:53 -0500)
committerKyle Kelley <kyle.kelley@rackspace.com>
Thu, 8 May 2014 18:53:11 +0000 (13:53 -0500)
tornado/test/websocket_test.py

index 1873af3fa21e34e30a5ce0d5424f700724b9f94b..3118e61e3703924f321f3d8dbbeddf678f75919a 100644 (file)
@@ -188,6 +188,21 @@ class WebSocketTest(AsyncHTTPTestCase):
         ws.close()
         yield self.close_future
 
+    @gen_test
+    def test_check_origin_with_path(self):
+        port = self.get_http_port()
+
+        url = 'ws://localhost:%d/echo' % port
+        headers = {'Origin': 'http://localhost:%d/something' % port}
+
+        ws = yield websocket_connect(HTTPRequest(url, headers=headers),
+            io_loop=self.io_loop)
+        ws.write_message('hello')
+        response = yield ws.read_message()
+        self.assertEqual(response, 'hello')
+        ws.close()
+        yield self.close_future
+
     @gen_test
     def test_check_origin_valid2(self):
         port = self.get_http_port()