aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_protocol_http.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_protocol_http.py')
-rw-r--r--test/test_protocol_http.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/test/test_protocol_http.py b/test/test_protocol_http.py
index db262950..16870777 100644
--- a/test/test_protocol_http.py
+++ b/test/test_protocol_http.py
@@ -31,7 +31,9 @@ class TestHTTPRequest:
f.request.host = f.server_conn.address.host
f.request.port = f.server_conn.address.port
f.request.scheme = "http"
- assert f.request.assemble() == "OPTIONS * HTTP/1.1\r\nHost: address:22\r\n\r\n"
+ assert f.request.assemble() == ("OPTIONS * HTTP/1.1\r\n"
+ "Host: address:22\r\n"
+ "Content-Length: 0\r\n\r\n")
def test_relative_form_in(self):
s = StringIO("GET /foo\xff HTTP/1.1")
@@ -58,7 +60,9 @@ class TestHTTPRequest:
s = StringIO("CONNECT address:22 HTTP/1.1")
r = HTTPRequest.from_stream(s)
r.scheme, r.host, r.port = "http", "address", 22
- assert r.assemble() == "CONNECT address:22 HTTP/1.1\r\nHost: address:22\r\n\r\n"
+ assert r.assemble() == ("CONNECT address:22 HTTP/1.1\r\n"
+ "Host: address:22\r\n"
+ "Content-Length: 0\r\n\r\n")
assert r.pretty_url(False) == "address:22"
def test_absolute_form_in(self):
@@ -66,7 +70,7 @@ class TestHTTPRequest:
tutils.raises("Bad HTTP request line", HTTPRequest.from_stream, s)
s = StringIO("GET http://address:22/ HTTP/1.1")
r = HTTPRequest.from_stream(s)
- assert r.assemble() == "GET http://address:22/ HTTP/1.1\r\nHost: address:22\r\n\r\n"
+ assert r.assemble() == "GET http://address:22/ HTTP/1.1\r\nHost: address:22\r\nContent-Length: 0\r\n\r\n"
def test_http_options_relative_form_in(self):
"""
@@ -77,9 +81,9 @@ class TestHTTPRequest:
r.host = 'address'
r.port = 80
r.scheme = "http"
- assert r.assemble() == ("OPTIONS "
- "/secret/resource "
- "HTTP/1.1\r\nHost: address\r\n\r\n")
+ assert r.assemble() == ("OPTIONS /secret/resource HTTP/1.1\r\n"
+ "Host: address\r\n"
+ "Content-Length: 0\r\n\r\n")
def test_http_options_absolute_form_in(self):
s = StringIO("OPTIONS http://address/secret/resource HTTP/1.1")
@@ -87,9 +91,9 @@ class TestHTTPRequest:
r.host = 'address'
r.port = 80
r.scheme = "http"
- assert r.assemble() == ("OPTIONS "
- "http://address:80/secret/resource "
- "HTTP/1.1\r\nHost: address\r\n\r\n")
+ assert r.assemble() == ("OPTIONS http://address:80/secret/resource HTTP/1.1\r\n"
+ "Host: address\r\n"
+ "Content-Length: 0\r\n\r\n")
def test_assemble_unknown_form(self):