#1291 http.server's send_error takes an optional explain argument

This commit is contained in:
Senthil Kumaran 2013-03-15 07:53:21 -07:00
parent 12bb353d43
commit 2688644eef
4 changed files with 33 additions and 10 deletions

View file

@ -95,6 +95,10 @@ class BaseHTTPServerTestCase(BaseTestCase):
def do_NOTFOUND(self):
self.send_error(404)
def do_EXPLAINERROR(self):
self.send_error(999, "Short Message",
"This is a long \n explaination")
def do_CUSTOM(self):
self.send_response(999)
self.send_header('Content-Type', 'text/html')
@ -206,6 +210,12 @@ class BaseHTTPServerTestCase(BaseTestCase):
res = self.con.getresponse()
self.assertEqual(res.status, 999)
def test_return_explain_error(self):
self.con.request('EXPLAINERROR', '/')
res = self.con.getresponse()
self.assertEqual(res.status, 999)
self.assertTrue(int(res.getheader('Content-Length')))
def test_latin1_header(self):
self.con.request('LATINONEHEADER', '/', headers={
'X-Special-Incoming': 'Ärger mit Unicode'