diff --git a/protocol/deno_streams/reply.ts b/protocol/deno_streams/reply.ts index f9b00962..60ab76e6 100644 --- a/protocol/deno_streams/reply.ts +++ b/protocol/deno_streams/reply.ts @@ -131,12 +131,23 @@ async function tryReadErrorReply(reader: BufReader): Promise { } async function readLine(reader: BufReader): Promise { - const result = await reader.readLine(); + let result = await reader.readLine(); if (result == null) { throw new InvalidStateError(); } - const { line } = result; + let line = result.line; + + while (result?.more) { + result = await reader.readLine(); + if (result == null) { + throw new InvalidStateError(); + } + const mergedLine = new Uint8Array(line.length + result.line.length); + mergedLine.set(line); + mergedLine.set(result.line, line.length); + line = mergedLine; + } return line; }