summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/http/client.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py
index b1b76c2..0477ddd 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -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."""