| 484 | self.assertEqual(expected, list(headers.get_all())) |
| 485 | |
| 486 | def test_optional_cr(self): |
| 487 | # Bare CR is not a valid line separator |
| 488 | with self.assertRaises(HTTPInputError): |
| 489 | HTTPHeaders.parse("CRLF: crlf\r\nLF: lf\nCR: cr\rMore: more\r\n") |
| 490 | |
| 491 | # Both CRLF and LF should be accepted as separators. CR should not be |
| 492 | # part of the data when followed by LF. |
| 493 | headers = HTTPHeaders.parse("CRLF: crlf\r\nLF: lf\nMore: more\r\n") |
| 494 | self.assertEqual( |
| 495 | sorted(headers.get_all()), |
| 496 | [("Crlf", "crlf"), ("Lf", "lf"), ("More", "more")], |
| 497 | ) |
| 498 | |
| 499 | def test_copy(self): |
| 500 | all_pairs = [("A", "1"), ("A", "2"), ("B", "c")] |