pfalcon / pycopy-lib

Standard library of the Pycopy project, minimalist and light-weight Python language implementation
https://github.com/pfalcon/pycopy
Other
246 stars 70 forks source link

Can't cast implicit from bytes to strint in uurequests.py -> request -> Tranfert-Ecoding value error #45

Closed mardigras2020 closed 4 years ago

mardigras2020 commented 4 years ago

I found this bug in uurequest.py in method

def request(method, url, data=None, json=None, headers={}, stream=None, parse_headers=True):
...
                if l.startswith(b"Transfer-Encoding:"):
                    if b"chunked" in l:
                        # decode added, can't cast implicit from bytes to string
                        raise ValueError("Unsupported " + l.decode('utf-8'))
...

I had to add the ".decode('utf-8')" otherwise get an error, when this error is thrown (at least on an ESP32)

pfalcon commented 4 years ago

Thanks for the report, fixed in both uurequests and urequests.