From d62dbee0f6cd47b4cad1ee7cc731b413600c0add Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sun, 19 Jul 2015 18:17:30 +0200 Subject: [PATCH] rename content -> body --- netlib/wsgi.py | 6 +++--- test/http/http1/test_protocol.py | 10 +++++----- test/http/http2/test_protocol.py | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/netlib/wsgi.py b/netlib/wsgi.py index ad43dc198..99afe00e3 100644 --- a/netlib/wsgi.py +++ b/netlib/wsgi.py @@ -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, diff --git a/test/http/http1/test_protocol.py b/test/http/http1/test_protocol.py index 6b8a884c7..936fe20de 100644 --- a/test/http/http1/test_protocol.py +++ b/test/http/http1/test_protocol.py @@ -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" diff --git a/test/http/http2/test_protocol.py b/test/http/http2/test_protocol.py index f41b95651..34e4ef500 100644 --- a/test/http/http2/test_protocol.py +++ b/test/http/http2/test_protocol.py @@ -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():