Skip to content

fix(http): parse complete Java SSE data events - #2284

Open
kyboi wants to merge 1 commit into
JetBrains:developfrom
Kreoh:contribute/java-sse-framing
Open

kyboi wants to merge 1 commit into
JetBrains:developfrom
Kreoh:contribute/java-sse-framing

Conversation

@kyboi

@kyboi kyboi commented Sep 30, 2026 •

Copy link
Copy Markdown

Closes #2279.

JavaKoogHttpClient.sse currently decodes each non-comment line. An event: field reaches the payload decoder, multiline JSON arrives as separate chunks, and whitespace or incomplete trailing data changes the result.

Accumulate data fields until an empty line, preserve payload whitespace, remove one leading BOM, ignore metadata and comments, and discard incomplete events at EOF. Filtering and decoding receive complete data events. The parsing follows the WHATWG contract.

This fix is already included in Kroog and is working in production applications using Kroog. This PR adapts the framing portion into a minimal patch. Original implementation by mrkim: d5ca5f6b2. Kroog also changes transport cancellation; this patch retains current transport handling, with lifetime and backpressure handled in #2285.

Validation: seven local HTTP server regression tests fail on the baseline and pass with this change. All 41 module JVM tests pass. Module ktlintCheck, jar and generatePomFileForMavenPublication pass; the compiled JVM ABI exactly matches the checked-in dump. No public signatures or dependencies change. The affected implementation is JVM only.

Target: develop.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Java HTTP client decodes individual SSE lines instead of complete data events

1 participant