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:
parent
d7516f4cd7
commit
028e274b22
@ -75,7 +75,8 @@ class LiveRewriter(object):
|
||||
else:
|
||||
continue
|
||||
|
||||
headers[name] = value
|
||||
if value:
|
||||
headers[name] = value
|
||||
|
||||
return headers
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user