mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
fix #659
This commit is contained in:
parent
f8d8a80bd0
commit
11215e46ec
@ -53,7 +53,7 @@ class _StreamingHttpLayer(_HttpLayer):
|
||||
|
||||
def read_response(self, request):
|
||||
response = self.read_response_headers()
|
||||
response.content = b"".join(
|
||||
response.data.content = b"".join(
|
||||
self.read_response_body(request, response)
|
||||
)
|
||||
return response
|
||||
@ -469,9 +469,9 @@ class HttpLayer(Layer):
|
||||
|
||||
if self.supports_streaming:
|
||||
if flow.response.stream:
|
||||
flow.response.content = CONTENT_MISSING
|
||||
flow.response.data.content = CONTENT_MISSING
|
||||
else:
|
||||
flow.response.content = b"".join(self.read_response_body(
|
||||
flow.response.data.content = b"".join(self.read_response_body(
|
||||
flow.request,
|
||||
flow.response
|
||||
))
|
||||
|
@ -1,7 +1,6 @@
|
||||
import socket
|
||||
from io import BytesIO
|
||||
from netlib.exceptions import HttpSyntaxException
|
||||
|
||||
from netlib.http import http1
|
||||
from netlib.tcp import TCPClient
|
||||
from netlib.tutils import treq, raises
|
||||
@ -82,3 +81,10 @@ class TestExpectHeader(tservers.HTTPProxTest):
|
||||
assert resp.status_code == 200
|
||||
|
||||
client.finish()
|
||||
|
||||
|
||||
class TestHeadContentLength(tservers.HTTPProxTest):
|
||||
def test_head_content_length(self):
|
||||
p = self.pathoc()
|
||||
resp = p.request("""head:'%s/p/200:h"Content-Length"="42"'""" % self.server.urlbase)
|
||||
assert resp.headers["Content-Length"] == "42"
|
Loading…
Reference in New Issue
Block a user