From f58dace86d15ef667cc226ec50d91399d8bdba7c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 25 Aug 2016 14:19:45 +0200 Subject: [PATCH] Respect multiple headers with the same name in .headers files. (#95) * Respect multiple headers with the same name in .headers files. Fixes #90. --- tests/functional/docroot/with_headers.txt.sub.headers | 2 ++ tests/functional/test_handlers.py | 1 + wptserve/response.py | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/functional/docroot/with_headers.txt.sub.headers b/tests/functional/docroot/with_headers.txt.sub.headers index 81c5985..4826221 100644 --- a/tests/functional/docroot/with_headers.txt.sub.headers +++ b/tests/functional/docroot/with_headers.txt.sub.headers @@ -1,3 +1,5 @@ Custom-Header: PASS Another-Header: {{$id:uuid()}} Same-Value-Header: {{$id}} +Double-Header: PA +Double-Header: SS diff --git a/tests/functional/test_handlers.py b/tests/functional/test_handlers.py index c4fe632..cfd84ef 100644 --- a/tests/functional/test_handlers.py +++ b/tests/functional/test_handlers.py @@ -21,6 +21,7 @@ def test_headers(self): # This will fail if it isn't a valid uuid uuid.UUID(resp.info()["Another-Header"]) self.assertEqual(resp.info()["Same-Value-Header"], resp.info()["Another-Header"]) + self.assertEqual(resp.info()["Double-Header"], "PA, SS") def test_range(self): diff --git a/wptserve/response.py b/wptserve/response.py index d4c7aab..d2a8de2 100644 --- a/wptserve/response.py +++ b/wptserve/response.py @@ -344,7 +344,7 @@ def items(self): def update(self, items_iter): for name, value in items_iter: - self.set(name, value) + self.append(name, value) def __repr__(self): return repr(self.data)