mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
rename content -> body
This commit is contained in:
parent
37a0cb858c
commit
d62dbee0f6
@ -21,9 +21,9 @@ class Flow(object):
|
||||
|
||||
class Request(object):
|
||||
|
||||
def __init__(self, scheme, method, path, headers, content):
|
||||
def __init__(self, scheme, method, path, headers, body):
|
||||
self.scheme, self.method, self.path = scheme, method, path
|
||||
self.headers, self.content = headers, content
|
||||
self.headers, self.body = headers, body
|
||||
|
||||
|
||||
def date_time_string():
|
||||
@ -58,7 +58,7 @@ class WSGIAdaptor(object):
|
||||
environ = {
|
||||
'wsgi.version': (1, 0),
|
||||
'wsgi.url_scheme': flow.request.scheme,
|
||||
'wsgi.input': cStringIO.StringIO(flow.request.content),
|
||||
'wsgi.input': cStringIO.StringIO(flow.request.body or ""),
|
||||
'wsgi.errors': errsoc,
|
||||
'wsgi.multithread': True,
|
||||
'wsgi.multiprocess': False,
|
||||
|
@ -296,7 +296,7 @@ class TestReadResponseNoContentLength(tservers.ServerTestBase):
|
||||
c = tcp.TCPClient(("127.0.0.1", self.port))
|
||||
c.connect()
|
||||
resp = HTTP1Protocol(c).read_response("GET", None)
|
||||
assert resp.content == "bar\r\n\r\n"
|
||||
assert resp.body == "bar\r\n\r\n"
|
||||
|
||||
|
||||
def test_read_response():
|
||||
@ -344,8 +344,8 @@ def test_read_response():
|
||||
|
||||
foo
|
||||
"""
|
||||
assert tst(data, "GET", None).content == 'foo'
|
||||
assert tst(data, "HEAD", None).content == ''
|
||||
assert tst(data, "GET", None).body == 'foo'
|
||||
assert tst(data, "HEAD", None).body == ''
|
||||
|
||||
data = """
|
||||
HTTP/1.1 200 OK
|
||||
@ -361,7 +361,7 @@ def test_read_response():
|
||||
|
||||
foo
|
||||
"""
|
||||
assert tst(data, "GET", None, include_body=False).content is None
|
||||
assert tst(data, "GET", None, include_body=False).body is None
|
||||
|
||||
|
||||
def test_get_request_line():
|
||||
@ -438,5 +438,5 @@ class TestReadRequest():
|
||||
p = mock_protocol(data)
|
||||
v = p.read_request()
|
||||
assert p.tcp_handler.wfile.getvalue() == "HTTP/1.1 100 Continue\r\n\r\n"
|
||||
assert v.content == "foo"
|
||||
assert v.body == "foo"
|
||||
assert p.tcp_handler.rfile.read(3) == "bar"
|
||||
|
@ -257,7 +257,7 @@ class TestReadResponse(tservers.ServerTestBase):
|
||||
assert resp.status_code == "200"
|
||||
assert resp.msg == ""
|
||||
assert resp.headers == {':status': '200', 'etag': 'foobar'}
|
||||
assert resp.content == b'foobar'
|
||||
assert resp.body == b'foobar'
|
||||
|
||||
|
||||
class TestReadEmptyResponse(tservers.ServerTestBase):
|
||||
@ -283,7 +283,7 @@ class TestReadEmptyResponse(tservers.ServerTestBase):
|
||||
assert resp.status_code == "200"
|
||||
assert resp.msg == ""
|
||||
assert resp.headers == {':status': '200', 'etag': 'foobar'}
|
||||
assert resp.content == b''
|
||||
assert resp.body == b''
|
||||
|
||||
|
||||
class TestReadRequest(tservers.ServerTestBase):
|
||||
@ -308,7 +308,7 @@ class TestReadRequest(tservers.ServerTestBase):
|
||||
|
||||
assert resp.stream_id
|
||||
assert resp.headers == {':method': 'GET', ':path': '/', ':scheme': 'https'}
|
||||
assert resp.content == b'foobar'
|
||||
assert resp.body == b'foobar'
|
||||
|
||||
|
||||
class TestCreateResponse():
|
||||
|
Loading…
Reference in New Issue
Block a user