Commit 7e5a1703 by Sheng

Added head method IndexHandler

parent a68eff59
...@@ -613,3 +613,18 @@ class TestAppNotFoundHandler(OtherTestBase): ...@@ -613,3 +613,18 @@ class TestAppNotFoundHandler(OtherTestBase):
response.headers['Server'], self.custom_headers['Server'] response.headers['Server'], self.custom_headers['Server']
) )
self.assertIn(b'404: Not Found', response.body) self.assertIn(b'404: Not Found', response.body)
class TestAppHeadRequest(OtherTestBase):
def test_with_index_path(self):
response = self.fetch('/', method='HEAD')
self.assertEqual(response.code, 200)
def test_with_ws_path(self):
response = self.fetch('/ws', method='HEAD')
self.assertEqual(response.code, 405)
def test_with_not_found_path(self):
response = self.fetch('/notfound', method='HEAD')
self.assertEqual(response.code, 404)
...@@ -288,6 +288,9 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler): ...@@ -288,6 +288,9 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
else: else:
future.set_result(worker) future.set_result(worker)
def head(self):
pass
def get(self): def get(self):
self.render('index.html', debug=self.debug) self.render('index.html', debug=self.debug)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment