pyodide-http
pyodide-http copied to clipboard
responses with transfer-encoding break the urllib handler
So, yall construct a fake full HTTP response here
https://github.com/koenvo/pyodide-http/blob/b5fc794dfd0f6db18304aa9ec4d967e07123b6fc/pyodide_http/_urllib.py#L38-L50
now, some http requests have transfer-encoding, where the data is chunked or zipped or something. problem is, XMLHttpRequest abstracts that away, but leaves the response headers. So JS passes decoded data, but says its chunked, which freaks out python's http lib.
the fix is simple, strip the transfer-encoding header before constructing the response.
this is confirmed working with chunked transferring. i am not 100% sure of gzip and such, but i imagine the same applies.