1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +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: else:
continue continue
headers[name] = value if value:
headers[name] = value
return headers return headers

View File

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