summaryrefslogtreecommitdiff
path: root/tests/test_httpheaders.py
diff options
context:
space:
mode:
authorcce <devnull@localhost>2005-12-26 06:39:30 +0000
committercce <devnull@localhost>2005-12-26 06:39:30 +0000
commit9c4ee3831cd606f2a9c0a23ded20f356db3100c2 (patch)
tree6318647da97100ec65d83e5000701c8bc58ae12f /tests/test_httpheaders.py
parenta438d9ab87e23a55b6c73f6919c6c696e2d0ba0b (diff)
downloadpaste-9c4ee3831cd606f2a9c0a23ded20f356db3100c2.tar.gz
- added normalize_headers to paste.httpheaders which sorts a set
of outgoing headers and capitalizes them to exactly match the RFC for extremely dumb user agents (which exist... unfortunately) that don't do case-insensitive matches and assume Camel-Case - added ResponseHeaderWrapper to use python properties to access headers which don't use multiple-entities (like Set-Cookie) - updated comment to header_value to explain why , separator works in most cases (but not all)
Diffstat (limited to 'tests/test_httpheaders.py')
-rw-r--r--tests/test_httpheaders.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_httpheaders.py b/tests/test_httpheaders.py
index 7345239..9df2814 100644
--- a/tests/test_httpheaders.py
+++ b/tests/test_httpheaders.py
@@ -29,3 +29,23 @@ def test_sorting():
('entity', 'Content-Encoding'),
('entity', 'Content-Type'),
('entity', 'Expires')]
+
+def test_normalize():
+ response_headers = [
+ ('www-authenticate','Response AuthMessage'),
+ ('unknown-header','Unknown Sorted Last'),
+ ('Via','General Bingles'),
+ ('aLLoW','Entity Allow Something'),
+ ('ETAG','Response 34234'),
+ ('expires','Entity An-Expiration-Date'),
+ ('date','General A-Date')]
+ normalize_headers(response_headers)
+ assert response_headers == [
+ ('Date', 'General A-Date'),
+ ('Via', 'General Bingles'),
+ ('ETag', 'Response 34234'),
+ ('WWW-Authenticate', 'Response AuthMessage'),
+ ('Allow', 'Entity Allow Something'),
+ ('Expires', 'Entity An-Expiration-Date'),
+ ('Unknown-Header', 'Unknown Sorted Last')]
+