mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-07 02:28:50 +00:00
Tests for flow_export.raw_request
This commit is contained in:
parent
ddeb3731a8
commit
56892f885b
@ -4,7 +4,7 @@ from . import tutils
|
|||||||
|
|
||||||
req_get = netlib.tutils.treq(
|
req_get = netlib.tutils.treq(
|
||||||
method='GET',
|
method='GET',
|
||||||
content=None,
|
content='',
|
||||||
)
|
)
|
||||||
|
|
||||||
req_post = netlib.tutils.treq(
|
req_post = netlib.tutils.treq(
|
||||||
@ -77,3 +77,25 @@ def test_python_code():
|
|||||||
""")\n\n"""
|
""")\n\n"""
|
||||||
"""print(response.text)""")
|
"""print(response.text)""")
|
||||||
assert flow_export.python_code(flow) == result
|
assert flow_export.python_code(flow) == result
|
||||||
|
|
||||||
|
|
||||||
|
def test_raw_request():
|
||||||
|
flow = tutils.tflow(req=req_get)
|
||||||
|
result = ("""GET /path HTTP/1.1\r\n"""
|
||||||
|
"""header: qvalue\r\n"""
|
||||||
|
"""host: address:22\r\n\r\n"""
|
||||||
|
"""""")
|
||||||
|
assert flow_export.raw_request(flow) == result
|
||||||
|
|
||||||
|
flow = tutils.tflow(req=req_post)
|
||||||
|
result = ("""POST /path HTTP/1.1\r\n"""
|
||||||
|
"""host: address:22\r\n\r\n"""
|
||||||
|
"""content""")
|
||||||
|
assert flow_export.raw_request(flow) == result
|
||||||
|
|
||||||
|
flow = tutils.tflow(req=req_patch)
|
||||||
|
result = ("""PATCH /path?query=param HTTP/1.1\r\n"""
|
||||||
|
"""header: qvalue\r\n"""
|
||||||
|
"""host: address:22\r\n\r\n"""
|
||||||
|
"""content""")
|
||||||
|
assert flow_export.raw_request(flow) == result
|
||||||
|
Loading…
Reference in New Issue
Block a user