http.client: Explicitly check for str type instead of "encode" method.

MicroPython string type shares setup with bytes, and thus both have entries
for "encode" and "decode" (but only one valid for a type really works).
pull/118/head^2
Paul Sokolovsky 2014-06-07 22:17:28 +03:00
rodzic 5fb6c52c1f
commit 471d805b45
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -1037,7 +1037,7 @@ class HTTPConnection:
header = header.encode('ascii')
values = list(values)
for i, one_value in enumerate(values):
if hasattr(one_value, 'encode'):
if isinstance(one_value, str):
values[i] = one_value.encode('latin-1')
elif isinstance(one_value, int):
values[i] = str(one_value).encode('ascii')