MCPcopy Index your code
hub / github.com/python/cpython / test_putrequest_override_encoding

Method test_putrequest_override_encoding

Lib/test/test_httplib.py:1604–1616  ·  view source on GitHub ↗

It should be possible to override the default encoding to transmit bytes in another encoding even if invalid (bpo-36274).

(self)

Source from the content-addressed store, hash-verified

1602 conn.putrequest('GET', '/', skip_host=1)
1603
1604 def test_putrequest_override_encoding(self):
1605 """
1606 It should be possible to override the default encoding
1607 to transmit bytes in another encoding even if invalid
1608 (bpo-36274).
1609 """
1610 class UnsafeHTTPConnection(client.HTTPConnection):
1611 def _encode_request(self, str_url):
1612 return str_url.encode('utf-8')
1613
1614 conn = UnsafeHTTPConnection('example.com')
1615 conn.sock = FakeSocket('')
1616 conn.putrequest('GET', '/☃')
1617
1618
1619class ExtendedReadTest(TestCase):

Callers

nothing calls this directly

Calls 3

putrequestMethod · 0.80
FakeSocketClass · 0.70

Tested by

no test coverage detected