Skip to content

Commit

Permalink
fix buffering
Browse files Browse the repository at this point in the history
  • Loading branch information
schiller-manuel committed Jan 24, 2025
1 parent a1b1956 commit 90abc8e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/start-server/src/transformStreamWithRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,16 @@ export function transformStreamWithRouter(
const text = decodeChunk(chunk.value)

const chunkString = leftover + text
const bodyStartMatch = chunkString.match(patternBodyStart)
const bodyEndMatch = chunkString.match(patternBodyEnd)
const htmlEndMatch = chunkString.match(patternHtmlEnd)

if (!bodyStarted) {
const bodyStartMatch = chunkString.match(patternBodyStart)
if (bodyStartMatch) {
bodyStarted = true
}
}

if (!headStarted) {
const headStartMatch = chunkString.match(patternHeadStart)
if (headStartMatch) {
Expand All @@ -197,9 +203,7 @@ export function transformStreamWithRouter(
}
}

if (bodyStartMatch) {
bodyStarted = true
}


if (!bodyStarted) {
finalPassThrough.write(chunkString)
Expand Down

0 comments on commit 90abc8e

Please sign in to comment.