summaryrefslogtreecommitdiffhomepage
path: root/test/test_routing.py
diff options
context:
space:
mode:
authorZhidao HONG <z.hong@f5.com>2022-09-19 02:45:44 +0800
committerZhidao HONG <z.hong@f5.com>2022-09-19 02:45:44 +0800
commit76df62a6236eba2ae1ea7ffe7b9599418b044a01 (patch)
tree4bf29cbfbdb838a74cb798cc9daecc7f36ac2b5f /test/test_routing.py
parent5354e05b2f09cbcc6dfeb0242f047ce169b0634b (diff)
downloadunit-76df62a6236eba2ae1ea7ffe7b9599418b044a01.tar.gz
unit-76df62a6236eba2ae1ea7ffe7b9599418b044a01.tar.bz2
HTTP: fixed cookie parsing.
The fixing supports the cookie value with the '=' character. This is related to #756 PR on Github. Thanks to changxiaocui.
Diffstat (limited to 'test/test_routing.py')
-rw-r--r--test/test_routing.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_routing.py b/test/test_routing.py
index 3649b37c..0d7b908c 100644
--- a/test/test_routing.py
+++ b/test/test_routing.py
@@ -1401,6 +1401,20 @@ class TestRouting(TestApplicationPython):
self.route_match_invalid({"cookies": ["var"]})
self.route_match_invalid({"cookies": [{"foo": {}}]})
+ def test_routes_match_cookies_complex(self):
+ self.route_match({"cookies": {"foo": "bar=baz"}})
+ self.cookie('foo=bar=baz', 200)
+ self.cookie(' foo=bar=baz ', 200)
+ self.cookie('=foo=bar=baz', 404)
+
+ self.route_match({"cookies": {"foo": ""}})
+ self.cookie('foo=', 200)
+ self.cookie('foo=;', 200)
+ self.cookie(' foo=;', 200)
+ self.cookie('foo', 404)
+ self.cookie('', 404)
+ self.cookie('=', 404)
+
def test_routes_match_cookies_multiple(self):
self.route_match({"cookies": {"foo": "bar", "blah": "blah"}})