http.client: Test string by type, not by presense of some method.

MicroPython has both encode() & decode() for both str & bytes, and it's
expensive to have it otherwise.
pull/118/head
Paul Sokolovsky 2014-05-25 23:02:53 +03:00
rodzic 34644d566e
commit 886587bd72
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -1038,7 +1038,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')