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) { while (!result.done) {
const text = decoder.decode(result.value); const text = decoder.decode(result.value);
buff_ += text; buff_ += text;
const newline = /\r?\n/gm; const lines = buff_.split('\n');
var rez = newline.exec(buff_); for (var i=0;i<lines.length - 1; i++){
while (rez){ handler(lines[i]);
handler(buff_.substring(0, rez.index));
buff_ = buff_.substr(newline.lastIndex);
rez = newline.exec(buff_);
} }
buff_ = lines[lines.length - 1];
result = await reader.read() result = await reader.read()
} }
if (buff_ != ''){ if (buff_ != ''){