Skip to content

Native browser network truncates text/event-stream response bodies to the first fragment #34786

Description

@mbranicky-doxee

Current behavior

On Cypress 16.0.0, a fetch() POST whose response is Content-Type: text/event-stream reaches the application truncated to its first fragment. The page's stream reader yields only the leading character of the body (<) instead of the full streamed reply.

The same spec passes on Cypress 15.21.1, and passes on 16.0.0 with forceHttp1: true, so the difference is isolated to the native browser network path.

This appears distinct from #34655 (progressive delivery collapsing into one late chunk) and #34623 (never-ending bodies wedging the CDP Fetch pause). Both of those closed before 16.0.0 shipped (2026-09-01), so their fixes are present here. The symptom here is loss of body content, not merely loss of progressive delivery.

Desired behavior

The application should receive the complete text/event-stream body, as it does on 15.x and on 16.0.0 with forceHttp1: true.

Test code to reproduce

Reduced from a real suite (a Vue 2 app with an Express mock). I have not run the snippet below as a
standalone project, so treat it as the shape of the failure rather than a verified minimal repro — happy to
put together a runnable reproduction if that helps triage.

Server (Express) — a finite SSE response:

app.post('/chat', (req, res) => {
  res.setHeader('Content-Type', 'text/event-stream')
  res.setHeader('Connection', 'keep-alive')
  res.write(`data: ${JSON.stringify({ text: '<fragment-container><text>hello world</text></fragment-container>' })}\n\n`)
  res.write(`data: [DONE]\n\n`)
  res.end()
})

Application code — consumes the body as a stream:

const response = await fetch('/chat', { method: 'POST', body: '{}' })
const reader = response.body.getReader()   // only the first fragment arrives on Cypress 16

Spec:

it('renders the streamed reply', () => {
  cy.get('[data-cy=send]').click()
  cy.get('[data-cy=reply]').should('contain.text', 'hello world')
  // Cypress 16.0.0: fails, "but the text was '<'"
  // Cypress 15.21.1: passes
  // Cypress 16.0.0 + forceHttp1: passes
})

Notes on what was ruled out

  • Reproduced with and without cy.intercept() registered on the endpoint — identical failure, so it is not an interception artefact.
  • Reproduced with both non-compliant (\ndata:{...}) and spec-compliant (data: {...}\n\n) SSE framing on the server.
  • Reproduced with a freshly wiped Cypress state directory and with retries disabled, so it is deterministic rather than state pollution.

Cypress Version

16.0.0

Node version

24.16.0

Operating System

macOS 26.6 (arm64); also reproduced on cypress/browsers:node-24.20.0-chrome-152.0.7977.64-1-ff-155.0-edge-152.0.4191.53-1 in CI (linux/amd64)

Browser

Chrome 152 (headless)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions