Skip to content

fix: handle CLRF and CR line endings in SSE parser - #3055

Merged
mrlubos merged 2 commits into
hey-api:mainfrom
nachogarcia:main
Dec 10, 2025
Merged

mrlubos merged 2 commits into
hey-api:mainfrom
nachogarcia:main

Conversation

@nachogarcia

Copy link
Copy Markdown
Contributor

Fixes #3054

The SSE parser only handled LF (\n) line endings, but the WHATWG HTML
Standard for Server-Sent Events supports three valid formats:

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

This caused parsing failures with servers like sse-starlette that use
CRLF by default. The fix normalizes all line endings to LF before
parsing.

Fixes compatibility with spec-compliant SSE servers.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel

vercel Bot commented Dec 10, 2025

Copy link
Copy Markdown

@nachogarcia is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Dec 10, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d663232

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug 🔥 Broken or incorrect behavior. client labels Dec 10, 2025

@mrlubos mrlubos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, thank you!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Dec 10, 2025
@codecov

codecov Bot commented Dec 10, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33.01%. Comparing base (271a0a2) to head (d663232).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3055   +/-   ##
=======================================
  Coverage   33.01%   33.01%           
=======================================
  Files         426      426           
  Lines       32797    32798    +1     
  Branches     2126     2126           
=======================================
+ Hits        10827    10828    +1     
  Misses      21942    21942           
  Partials       28       28           
Flag Coverage Δ
unittests 33.01% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Dec 10, 2025

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/codegen-core@3055
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@3055
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@3055
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@3055

commit: d663232

@mrlubos
mrlubos merged commit f14d243 into hey-api:main Dec 10, 2025
@hey-api hey-api Bot mentioned this pull request Dec 10, 2025
IAluI pushed a commit to IAluI/openapi-ts that referenced this pull request Sep 26, 2026
fix: handle CLRF and CR line endings in SSE parser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🔥 Broken or incorrect behavior. lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants