mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Fix test that may fail due to binary header data
This is just inherently not a determinisitc test. We don't use the log HTTP interface any more, so it can just go. A more radical "solution" is inbound shortly. Fixes #1207
This commit is contained in:
parent
2355c29c0e
commit
c0c45c051a
@ -340,7 +340,9 @@ def _read_headers(rfile):
|
|||||||
raise ValueError()
|
raise ValueError()
|
||||||
ret.append((name, value))
|
ret.append((name, value))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise exceptions.HttpSyntaxException("Invalid headers")
|
raise exceptions.HttpSyntaxException(
|
||||||
|
"Invalid header line: %s" % repr(line)
|
||||||
|
)
|
||||||
return headers.Headers(ret)
|
return headers.Headers(ret)
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,9 +32,6 @@ class TestApp(tutils.DaemonTests):
|
|||||||
assert self.getpath("/log/%s" % id).status_code == 200
|
assert self.getpath("/log/%s" % id).status_code == 200
|
||||||
assert self.getpath("/log/9999999").status_code == 404
|
assert self.getpath("/log/9999999").status_code == 404
|
||||||
|
|
||||||
def test_log_binary(self):
|
|
||||||
assert self.get("200:h@10b=@10b:da")
|
|
||||||
|
|
||||||
def test_response_preview(self):
|
def test_response_preview(self):
|
||||||
r = self.getpath("/response_preview", params=dict(spec="200"))
|
r = self.getpath("/response_preview", params=dict(spec="200"))
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
@ -187,7 +187,7 @@ class TestDaemon(_TestDaemon):
|
|||||||
|
|
||||||
def test_showresp_httperr(self):
|
def test_showresp_httperr(self):
|
||||||
v = self.tval(["get:'/p/200:d20'"], showresp=True, showsummary=True)
|
v = self.tval(["get:'/p/200:d20'"], showresp=True, showsummary=True)
|
||||||
assert "Invalid headers" in v
|
assert "Invalid header" in v
|
||||||
assert "HTTP/" in v
|
assert "HTTP/" in v
|
||||||
|
|
||||||
def test_explain(self):
|
def test_explain(self):
|
||||||
|
@ -102,7 +102,9 @@ class DaemonTests(object):
|
|||||||
fp=logfp,
|
fp=logfp,
|
||||||
)
|
)
|
||||||
with c.connect():
|
with c.connect():
|
||||||
resp = c.request("get:/p/%s" % urllib.quote(spec).encode("string_escape"))
|
resp = c.request(
|
||||||
|
"get:/p/%s" % urllib.quote(spec).encode("string_escape")
|
||||||
|
)
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def pathoc(
|
def pathoc(
|
||||||
|
Loading…
Reference in New Issue
Block a user