Simplify conditional block
MODIFY
urllib3/response.py
urllib3/response.py
@@ -234,7 +234,8 @@ class HTTPResponse(io.IOBase):
"""
length = self.headers.get('content-length')
- if length is not None and self.chunked:
+ if length is not None:
+ if self.chunked:
# This Response will fail with an IncompleteRead if it can't be
# received as chunked. This method falls back to attempt reading
# the response before raising an exception.
@@ -245,7 +246,6 @@ class HTTPResponse(io.IOBase):
"chunked.")
return None
- elif length is not None:
try:
# RFC 7230 section 3.3.2 specifies multiple content lengths can
# be sent in a single Content-Length header

Simplify conditional block (#1388)