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