MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_invalid_method_names

Method test_invalid_method_names

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

Source from the content-addressed store, hash-verified

389
390class HttpMethodTests(TestCase):
391 def test_invalid_method_names(self):
392 methods = (
393 'GET\r',
394 'POST\n',
395 'PUT\n\r',
396 'POST\nValue',
397 'POST\nHOST:abc',
398 'GET\nrHost:abc\n',
399 'POST\rRemainder:\r',
400 'GET\rHOST:\n',
401 '\nPUT'
402 )
403
404 for method in methods:
405 with self.assertRaisesRegex(
406 ValueError, "method can't contain control characters"):
407 conn = client.HTTPConnection('example.com')
408 conn.sock = FakeSocket(None)
409 conn.request(method=method, url="/")
410
411
412class TransferEncodingTest(TestCase):

Callers

nothing calls this directly

Calls 3

requestMethod · 0.95
assertRaisesRegexMethod · 0.80
FakeSocketClass · 0.70

Tested by

no test coverage detected