I think you can’t get a stream from the HTTP response (to be confirmed !): there is no such API with the Http client or the standard library. But you can get the full response as bytes with the Http.onBytes handler.
Beware: the documentation is not up to date. It says “containing the result String” but it’s really a Bytes instance that is passed. Http.onData is just a convenient handler converting the Http.onBytes result to a string.
Can you post the response headers and its body? You get this error when there is a Transfer-Encoding: chunked header and… (well, I don’t really understand what the code is doing!).
I assume (from your other post) the response used chunked encoding and the body is empty. I think that is invalid according to the doc.
Data is sent in a series of chunks. The Content-Length header is omitted in this case and at the beginning of each chunk you need to add the length of the current chunk in hexadecimal format, followed by '\r\n ’ and then the chunk itself, followed by another '\r\n '. The terminating chunk is a regular chunk, with the exception that its length is zero. It is followed by the trailer, which consists of a (possibly empty) sequence of entity header fields.
I think the code you are using expects at least one chunk (can be empty chunk) in the body.