mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
test coverage++
This commit is contained in:
parent
01ddda75e8
commit
484e099eb1
@ -30,6 +30,7 @@ def cleanup_request(f: flow.Flow) -> http.HTTPRequest:
|
|||||||
def request_content_for_console(request: http.HTTPRequest) -> str:
|
def request_content_for_console(request: http.HTTPRequest) -> str:
|
||||||
try:
|
try:
|
||||||
text = request.get_text(strict=True)
|
text = request.get_text(strict=True)
|
||||||
|
assert text
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# shlex.quote doesn't support a bytes object
|
# shlex.quote doesn't support a bytes object
|
||||||
# see https://github.com/python/cpython/pull/10871
|
# see https://github.com/python/cpython/pull/10871
|
||||||
|
@ -77,6 +77,14 @@ class TestExportCurlCommand:
|
|||||||
assert shlex.split(command)[-2] == '-d'
|
assert shlex.split(command)[-2] == '-d'
|
||||||
assert shlex.split(command)[-1] == "'&#"
|
assert shlex.split(command)[-1] == "'&#"
|
||||||
|
|
||||||
|
def test_strip_unnecessary(self, get_request):
|
||||||
|
get_request.request.headers.clear()
|
||||||
|
get_request.request.headers["host"] = "address"
|
||||||
|
get_request.request.headers[":authority"] = "address"
|
||||||
|
get_request.request.headers["accept-encoding"] = "br"
|
||||||
|
result = """curl --compressed 'http://address:22/path?a=foo&a=bar&b=baz'"""
|
||||||
|
assert export.curl_command(get_request) == result
|
||||||
|
|
||||||
|
|
||||||
class TestExportHttpieCommand:
|
class TestExportHttpieCommand:
|
||||||
def test_get(self, get_request):
|
def test_get(self, get_request):
|
||||||
|
Loading…
Reference in New Issue
Block a user