mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-01 15:55:28 +00:00
Merge pull request #1072 from mitmproxy/remove-response-msg
response.msg -> response.reason
This commit is contained in:
commit
94342891ee
@ -143,7 +143,7 @@ def response(context, flow):
|
|||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"status": flow.response.status_code,
|
"status": flow.response.status_code,
|
||||||
"statusText": flow.response.msg,
|
"statusText": flow.response.reason,
|
||||||
"httpVersion": flow.response.http_version,
|
"httpVersion": flow.response.http_version,
|
||||||
"cookies": format_cookies(flow.response.cookies),
|
"cookies": format_cookies(flow.response.cookies),
|
||||||
"headers": format_headers(flow.response.headers),
|
"headers": format_headers(flow.response.headers),
|
||||||
|
@ -28,7 +28,6 @@ class Error(stateobject.StateObject):
|
|||||||
@type msg: str
|
@type msg: str
|
||||||
@type timestamp: float
|
@type timestamp: float
|
||||||
"""
|
"""
|
||||||
self.flow = None # will usually be set by the flow backref mixin
|
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
self.timestamp = timestamp or utils.timestamp()
|
self.timestamp = timestamp or utils.timestamp()
|
||||||
|
|
||||||
|
@ -103,13 +103,3 @@ class Response(Message):
|
|||||||
def set_cookies(self, odict): # pragma: no cover
|
def set_cookies(self, odict): # pragma: no cover
|
||||||
warnings.warn(".set_cookies is deprecated, use .cookies instead.", DeprecationWarning)
|
warnings.warn(".set_cookies is deprecated, use .cookies instead.", DeprecationWarning)
|
||||||
self.cookies = odict
|
self.cookies = odict
|
||||||
|
|
||||||
@property
|
|
||||||
def msg(self): # pragma: no cover
|
|
||||||
warnings.warn(".msg is deprecated, use .reason instead.", DeprecationWarning)
|
|
||||||
return self.reason
|
|
||||||
|
|
||||||
@msg.setter
|
|
||||||
def msg(self, reason): # pragma: no cover
|
|
||||||
warnings.warn(".msg is deprecated, use .reason instead.", DeprecationWarning)
|
|
||||||
self.reason = reason
|
|
||||||
|
@ -425,7 +425,7 @@ class Pathoc(tcp.TCPClient):
|
|||||||
finally:
|
finally:
|
||||||
if resp:
|
if resp:
|
||||||
lg("<< %s %s: %s bytes" % (
|
lg("<< %s %s: %s bytes" % (
|
||||||
resp.status_code, utils.xrepr(resp.msg), len(resp.content)
|
resp.status_code, utils.xrepr(resp.reason), len(resp.content)
|
||||||
))
|
))
|
||||||
if resp.status_code in self.ignorecodes:
|
if resp.status_code in self.ignorecodes:
|
||||||
lg.suppress()
|
lg.suppress()
|
||||||
|
@ -417,7 +417,7 @@ class TestReadResponse(tservers.ServerTestBase):
|
|||||||
|
|
||||||
assert resp.http_version == "HTTP/2.0"
|
assert resp.http_version == "HTTP/2.0"
|
||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
assert resp.msg == ''
|
assert resp.reason == ''
|
||||||
assert resp.headers.fields == [[b':status', b'200'], [b'etag', b'foobar']]
|
assert resp.headers.fields == [[b':status', b'200'], [b'etag', b'foobar']]
|
||||||
assert resp.content == b'foobar'
|
assert resp.content == b'foobar'
|
||||||
assert resp.timestamp_end
|
assert resp.timestamp_end
|
||||||
@ -444,7 +444,7 @@ class TestReadEmptyResponse(tservers.ServerTestBase):
|
|||||||
assert resp.stream_id == 42
|
assert resp.stream_id == 42
|
||||||
assert resp.http_version == "HTTP/2.0"
|
assert resp.http_version == "HTTP/2.0"
|
||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
assert resp.msg == ''
|
assert resp.reason == ''
|
||||||
assert resp.headers.fields == [[b':status', b'200'], [b'etag', b'foobar']]
|
assert resp.headers.fields == [[b':status', b'200'], [b'etag', b'foobar']]
|
||||||
assert resp.content == b''
|
assert resp.content == b''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user