1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

header rewriter: ensure the 'Status' header is prefix-rewritten, update test

This commit is contained in:
Ilya Kreymer 2018-10-21 13:59:29 -07:00
parent c28e38718c
commit f76ba06c42
2 changed files with 7 additions and 2 deletions

View File

@ -58,6 +58,8 @@ class DefaultHeaderRewriter(object):
'set-cookie': 'cookie',
'status': 'prefix',
'strict-transport-security': 'prefix',
'trailer': 'prefix',

View File

@ -111,7 +111,8 @@ X-Archive-Orig-Transfer-Encoding: chunked\r\n\
('Set-Cookie', 'foo=bar; Path=/; abc=123; Path=/path.html'),
('Content-Encoding', 'gzip'),
('Transfer-Encoding', 'chunked'),
('X-Custom', 'test')]
('X-Custom', 'test'),
('Status', '200')]
rwinfo = self.do_rewrite('200 OK', headers)
http_headers = DefaultHeaderRewriter(rwinfo)()
@ -126,7 +127,9 @@ X-Archive-Orig-Transfer-Encoding: chunked\r\n\
assert(('X-Archive-Orig-Transfer-Encoding', 'chunked') in http_headers.headers)
assert(('X-Custom', 'test') in http_headers.headers)
assert(len(http_headers.headers) == 7)
assert(('X-Archive-Orig-Status', '200') in http_headers.headers)
assert(len(http_headers.headers) == 8)
assert rwinfo.text_type == None
assert rwinfo.charset == None