mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
#1291 http.server's send_error takes an optional explain argument
This commit is contained in:
parent
12bb353d43
commit
2688644eef
4 changed files with 33 additions and 10 deletions
|
@ -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'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue