Added attribute custom_headers to MixinHandler

This commit is contained in:
Sheng
2018-10-16 15:14:34 +08:00
parent af60cd1cd5
commit a68eff592f
2 changed files with 17 additions and 4 deletions
+11 -3
View File
@@ -586,22 +586,30 @@ class TestAppWithTrustedStream(OtherTestBase):
class TestAppNotFoundHandler(OtherTestBase):
custom_headers = handler.MixinHandler.custom_headers
def test_with_not_found_get_request(self):
response = self.fetch('/pathnotfound', method='GET')
self.assertEqual(response.code, 404)
self.assertEqual(response.headers['Server'], 'TornadoServer')
self.assertEqual(
response.headers['Server'], self.custom_headers['Server']
)
self.assertIn(b'404: Not Found', response.body)
def test_with_not_found_post_request(self):
response = self.fetch('/pathnotfound', method='POST',
body=urlencode(self.body), headers=self.headers)
self.assertEqual(response.code, 404)
self.assertEqual(response.headers['Server'], 'TornadoServer')
self.assertEqual(
response.headers['Server'], self.custom_headers['Server']
)
self.assertIn(b'404: Not Found', response.body)
def test_with_not_found_put_request(self):
response = self.fetch('/pathnotfound', method='PUT',
body=urlencode(self.body), headers=self.headers)
self.assertEqual(response.code, 404)
self.assertEqual(response.headers['Server'], 'TornadoServer')
self.assertEqual(
response.headers['Server'], self.custom_headers['Server']
)
self.assertIn(b'404: Not Found', response.body)