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

Method test_invalid_method_names

Lib/test/test_httplib.py:437–455  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

435
436class HttpMethodTests(TestCase):
437 def test_invalid_method_names(self):
438 methods = (
439 'GET\r',
440 'POST\n',
441 'PUT\n\r',
442 'POST\nValue',
443 'POST\nHOST:abc',
444 'GET\nrHost:abc\n',
445 'POST\rRemainder:\r',
446 'GET\rHOST:\n',
447 '\nPUT'
448 )
449
450 for method in methods:
451 with self.assertRaisesRegex(
452 ValueError, "method can't contain control characters"):
453 conn = client.HTTPConnection('example.com')
454 conn.sock = FakeSocket(None)
455 conn.request(method=method, url="/")
456
457
458class TransferEncodingTest(TestCase):

Callers

nothing calls this directly

Calls 3

requestMethod · 0.95
assertRaisesRegexMethod · 0.80
FakeSocketClass · 0.70

Tested by

no test coverage detected