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

rewrite tests: improve POST test, only add header if not empty

This commit is contained in:
Ilya Kreymer 2014-06-14 00:18:35 -07:00
parent d7516f4cd7
commit 028e274b22
2 changed files with 8 additions and 4 deletions

View File

@ -75,7 +75,8 @@ class LiveRewriter(object):
else:
continue
headers[name] = value
if value:
headers[name] = value
return headers

View File

@ -84,11 +84,14 @@ def test_example_domain_specific_3():
def test_post():
buff = BytesIO('ABCDEF')
buff = BytesIO('ABC=DEF')
env = {'REQUEST_METHOD': 'POST',
'HTTP_ORIGIN': 'http://example.com',
'HTTP_HOST': 'example.com',
'HTTP_ORIGIN': 'http://httpbin.org',
'HTTP_HOST': 'httpbin.org',
'HTTP_CONNECTION': 'close',
'CONTENT_LENGTH': str(len(buff.getvalue())),
'CONTENT_TYPE': 'application/x-www-form-urlencoded',
'wsgi.input': buff}
status_headers, resp_buff = get_rewritten('http://httpbin.org/post', urlrewriter, env=env)