summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httpservers.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2013-03-15 14:53:21 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2013-03-15 14:53:21 (GMT)
commit2688644eef0766ddb22695664e76fe567ceabac5 (patch)
treecb7abef878a28fc916b68476de5c7ffed19efbaf /Lib/test/test_httpservers.py
parent12bb353d43e69f4ec1bd9959261aedddbe760f7d (diff)
downloadcpython-2688644eef0766ddb22695664e76fe567ceabac5.zip
cpython-2688644eef0766ddb22695664e76fe567ceabac5.tar.gz
cpython-2688644eef0766ddb22695664e76fe567ceabac5.tar.bz2
#1291 http.server's send_error takes an optional explain argument
Diffstat (limited to 'Lib/test/test_httpservers.py')
-rw-r--r--Lib/test/test_httpservers.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index 92306ae..ec751cc 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -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'