Skip to content

SSE parser doesn't handle CRLF line endings (spec-compliant servers) #3054

Closed

Description

@nachogarcia

Description

The SSE client in serverSentEvents.gen.ts fails to parse events from servers that use \r\n (CRLF) line endings. According to the WHATWG HTML Standard, SSE supports three valid line ending formats:

  • \r\n (CRLF)
  • \n (LF)
  • \r (CR)

The current implementation only handles \n (LF) by splitting on \n\n.

Reproducible example or configuration

  1. Use an SSE server that sends CRLF line endings (e.g., Python's sse-starlette which defaults to \r\n)
  2. Connect using the generated SDK's SSE client
  3. Events are never parsed because buffer.split('\n\n') doesn't match \r\n\r\n

Expected Behavior

Events should be parsed regardless of line ending style (CRLF, LF, or CR).

Current Behavior

The buffer keeps growing but chunks.length is always 0 because the split doesn't find \n\n when the data contains \r\n\r\n.

OpenAPI specification (optional)

No response

System information (optional)

No response

Activity

  1. added
    bug 🔥
    on Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions