MCPcopy
hub / github.com/django/django / test_multiple_cookie_headers_http2

Method test_multiple_cookie_headers_http2

tests/asgi/tests.py:776–805  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

774 self.assertTrue(any(t != loop_thread for t in called_threads))
775
776 def test_multiple_cookie_headers_http2(self):
777 test_cases = [
778 {
779 "label": "RFC-compliant headers (no semicolon)",
780 "headers": [
781 (b"cookie", b"a=abc"),
782 (b"cookie", b"b=def"),
783 (b"cookie", b"c=ghi"),
784 ],
785 },
786 {
787 # Some clients may send cookies with trailing semicolons.
788 "label": "Headers with trailing semicolons",
789 "headers": [
790 (b"cookie", b"a=abc;"),
791 (b"cookie", b"b=def;"),
792 (b"cookie", b"c=ghi;"),
793 ],
794 },
795 ]
796
797 for case in test_cases:
798 with self.subTest(case["label"]):
799 scope = self.async_request_factory._base_scope(
800 path="/", http_version="2.0"
801 )
802 scope["headers"] = case["headers"]
803 request = ASGIRequest(scope, None)
804 self.assertEqual(request.META["HTTP_COOKIE"], "a=abc; b=def; c=ghi")
805 self.assertEqual(request.COOKIES, {"a": "abc", "b": "def", "c": "ghi"})
806
807
808class MaxMemorySizeASGITests(SimpleTestCase):

Callers

nothing calls this directly

Calls 2

ASGIRequestClass · 0.90
_base_scopeMethod · 0.80

Tested by

no test coverage detected