fix(sse): preserve event state and validate streaming responses - #32
Open
rupayon123 wants to merge 9 commits into
Open
rupayon123 wants to merge 9 commits into
rupayon123 wants to merge 9 commits into
Conversation
Contributor
Author
|
Additional fixes pushed to this branch:
Full Go tests, go vet and build pass, including a live local streaming server that previously hung after an output failure. The stream now closes promptly and preserves the original write error. A subsequent cleanup separates event formatting from connection lifecycle. Today's changes have no new findings under golangci-lint v2.13.2 using a migrated copy of the repository configuration. This is a scoped lint result: a full CLI-branch scan still reports 93 findings outside today's changes; the legacy v1 linter cannot read the installed Go 1.27 export format. Prepared with AI assistance. Changes are submitted for review; this is not a claim of maintainer approval. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and change
Bring SSE parsing and streaming behavior in line with event-stream semantics. Preserve empty data fields and persistent event IDs/retry intervals; accept CR, LF, CRLF and a leading UTF-8 BOM; and reject invalid retry values.
The streaming follow-up fixes effective event filtering: untyped events use
message, and event names match exactly rather than case-insensitively. Validate the response media type before creating an output log, so an HTML/JSON error response cannot overwrite a prior log. Support data lines smaller than 1 MiB with a documented bounded scanner rather than failing on ordinary 128 KiB payloads.Custom SSE headers now honor case-insensitive
Hostoverrides through the request host field, and malformed headers are rejected before making a network request.Validation
env -u NO_COLOR go test ./...,go vet ./..., formatting and diff checks pass after each change.golangci-lintis unavailable locally. No claim of automatic reconnection is made.Prepared with AI assistance.