Fix closes Issue12676 - Invalid identifier used in TypeError message in http.client.
Reported by Popa Claudiu and Patch by Santoso Wijaya.
This commit is contained in:
parent
f187a0230b
commit
eb71ad4c71
|
@ -778,7 +778,7 @@ class HTTPConnection:
|
||||||
self.sock.sendall(d)
|
self.sock.sendall(d)
|
||||||
else:
|
else:
|
||||||
raise TypeError("data should be a bytes-like object\
|
raise TypeError("data should be a bytes-like object\
|
||||||
or an iterable, got %r " % type(it))
|
or an iterable, got %r " % type(data))
|
||||||
|
|
||||||
def _output(self, s):
|
def _output(self, s):
|
||||||
"""Add a line of output to the current request buffer.
|
"""Add a line of output to the current request buffer.
|
||||||
|
|
|
@ -246,6 +246,13 @@ class BasicTest(TestCase):
|
||||||
conn.request('GET', '/foo', body(), {'Content-Length': '11'})
|
conn.request('GET', '/foo', body(), {'Content-Length': '11'})
|
||||||
self.assertEqual(sock.data, expected)
|
self.assertEqual(sock.data, expected)
|
||||||
|
|
||||||
|
def test_send_type_error(self):
|
||||||
|
# See: Issue #12676
|
||||||
|
conn = client.HTTPConnection('example.com')
|
||||||
|
conn.sock = FakeSocket('')
|
||||||
|
with self.assertRaises(TypeError):
|
||||||
|
conn.request('POST', 'test', conn)
|
||||||
|
|
||||||
def test_chunked(self):
|
def test_chunked(self):
|
||||||
chunked_start = (
|
chunked_start = (
|
||||||
'HTTP/1.1 200 OK\r\n'
|
'HTTP/1.1 200 OK\r\n'
|
||||||
|
|
Loading…
Reference in New Issue