Merge pull request #1072 from mitmproxy/remove-response-msg

response.msg -> response.reason
This commit is contained in:
Thomas Kriechbaumer 2016-04-03 10:14:06 +02:00
commit 94342891ee
5 changed files with 4 additions and 15 deletions

View File

@ -143,7 +143,7 @@ def response(context, flow):
},
"response": {
"status": flow.response.status_code,
"statusText": flow.response.msg,
"statusText": flow.response.reason,
"httpVersion": flow.response.http_version,
"cookies": format_cookies(flow.response.cookies),
"headers": format_headers(flow.response.headers),

View File

@ -28,7 +28,6 @@ class Error(stateobject.StateObject):
@type msg: str
@type timestamp: float
"""
self.flow = None # will usually be set by the flow backref mixin
self.msg = msg
self.timestamp = timestamp or utils.timestamp()

View File

@ -103,13 +103,3 @@ class Response(Message):
def set_cookies(self, odict): # pragma: no cover
warnings.warn(".set_cookies is deprecated, use .cookies instead.", DeprecationWarning)
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

View File

@ -425,7 +425,7 @@ class Pathoc(tcp.TCPClient):
finally:
if resp:
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:
lg.suppress()

View File

@ -417,7 +417,7 @@ class TestReadResponse(tservers.ServerTestBase):
assert resp.http_version == "HTTP/2.0"
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.content == b'foobar'
assert resp.timestamp_end
@ -444,7 +444,7 @@ class TestReadEmptyResponse(tservers.ServerTestBase):
assert resp.stream_id == 42
assert resp.http_version == "HTTP/2.0"
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.content == b''