Resolve mypy issue
This commit is contained in:
parent
662c7c7f62
commit
be1ca93a23
|
@ -355,7 +355,7 @@ class ASGIApp:
|
||||||
is_streaming = isinstance(response, StreamingHTTPResponse)
|
is_streaming = isinstance(response, StreamingHTTPResponse)
|
||||||
if is_streaming and getattr(response, "chunked", False):
|
if is_streaming and getattr(response, "chunked", False):
|
||||||
# disable sanic chunking, this is done at the ASGI-server level
|
# disable sanic chunking, this is done at the ASGI-server level
|
||||||
response.chunked = False
|
setattr(response, "chunked", False)
|
||||||
# content-length header is removed to signal to the ASGI-server
|
# content-length header is removed to signal to the ASGI-server
|
||||||
# to use automatic-chunking if it supports it
|
# to use automatic-chunking if it supports it
|
||||||
elif len(content_length) > 0:
|
elif len(content_length) > 0:
|
||||||
|
@ -364,7 +364,10 @@ class ASGIApp:
|
||||||
]
|
]
|
||||||
elif not is_streaming:
|
elif not is_streaming:
|
||||||
headers += [
|
headers += [
|
||||||
(b"content-length", str(len(response.body)).encode("latin-1"))
|
(
|
||||||
|
b"content-length",
|
||||||
|
str(len(getattr(response, "body", b""))).encode("latin-1"),
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
if "content-type" not in response.headers:
|
if "content-type" not in response.headers:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user