MCPcopy Create free account
hub / github.com/EasyIME/PIME / test_multi_line

Method test_multi_line

python/python3/tornado/test/httputil_test.py:263–287  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

261
262class HTTPHeadersTest(unittest.TestCase):
263 def test_multi_line(self):
264 # Lines beginning with whitespace are appended to the previous line
265 # with any leading whitespace replaced by a single space.
266 # Note that while multi-line headers are a part of the HTTP spec,
267 # their use is strongly discouraged.
268 data = """\
269Foo: bar
270 baz
271Asdf: qwer
272\tzxcv
273Foo: even
274 more
275 lines
276""".replace(
277 "\n", "\r\n"
278 )
279 headers = HTTPHeaders.parse(data)
280 self.assertEqual(headers["asdf"], "qwer zxcv")
281 self.assertEqual(headers.get_list("asdf"), ["qwer zxcv"])
282 self.assertEqual(headers["Foo"], "bar baz,even more lines")
283 self.assertEqual(headers.get_list("foo"), ["bar baz", "even more lines"])
284 self.assertEqual(
285 sorted(list(headers.get_all())),
286 [("Asdf", "qwer zxcv"), ("Foo", "bar baz"), ("Foo", "even more lines")],
287 )
288
289 def test_malformed_continuation(self):
290 # If the first line starts with whitespace, it's a

Callers

nothing calls this directly

Calls 5

listFunction · 0.85
replaceMethod · 0.80
get_listMethod · 0.80
get_allMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected