Commit 48bd7970 authored by Jeremy Hylton's avatar Jeremy Hylton

Simplify complex expression.

parent 389aca5a
......@@ -906,7 +906,9 @@ class HTTPConnection:
self._set_content_length(body)
for hdr, value in headers.items():
self.putheader(hdr, value)
self.endheaders(body.encode('ascii') if isinstance(body, str) else body)
if isinstance(body, str):
body = body.encode('ascii')
self.endheaders(body)
def getresponse(self):
"""Get the response from the server."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment