This commit is contained in:
yumoqing 2024-04-11 16:48:39 +08:00
parent d6c2363da2
commit 694b488f0d

View File

@ -210,13 +210,11 @@ bricks.HttpResponseStream = class extends bricks.HttpResponse {
while (!result.done) {
const text = decoder.decode(result.value);
buff_ += text;
const newline = /\r?\n/gm;
var rez = newline.exec(buff_);
while (rez){
handler(buff_.substring(0, rez.index));
buff_ = buff_.substr(newline.lastIndex);
rez = newline.exec(buff_);
const lines = buff_.split('\n');
for (var i=0;i<lines.length - 1; i++){
handler(lines[i]);
}
buff_ = lines[lines.length - 1];
result = await reader.read()
}
if (buff_ != ''){