You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sending 103 Early Hints currently commits Echo's response, so a later explicit status or error response can be discarded. Keep informational responses provisional across the response, HEAD, gzip, and delayed JSON writers, while preserving 101 Switching Protocols as final.
Validation limit: Local checks used Windows/amd64 with Go 1.27.1. Race testing could not run because CGO is disabled; other OS/Go configurations and upstream CI are unverified.
Implementation and validation
Forward informational headers immediately without changing final status, commitment, byte accounting, or invoking final-response hooks.
Respect gzip's existing buffered-header/body state so a late informational header cannot follow a logically committed final response.
Preserve delayed JSON status overrides and serialization-error recovery. No public API, dependency, configuration, Flush, or upgrade-handling changes.
Update the directly affected GoDoc.
Reproduce the original failure with real Echo HTTP handlers on the unchanged base: 103 followed by 201 sends a final 200. Final regression tests also fail against exact base source via a Go overlay.
Cover repeated informational responses over HTTP/1.1 and HTTP/2, immediate delivery, final headers/body, hooks and byte accounting, HEAD, gzip thresholds, error handling, custom serializers, and terminal-status controls.
Check late informational responses against unwrapped net/http, including buffered gzip and delayed JSON paths.
Passing local commands, with isolated caches and bounded concurrency:
go test -mod=readonly -p=1 -parallel=1 -count=1 .\...
go vet -mod=readonly -p=1 .\...
go build -mod=readonly -p=1 .\...
staticcheck .\...
golint -set_exit_status . .\echotest .\middleware
Staticcheck: 2026.2.1. Golint: v0.0.0-20241112194109-818c5a804067. Lint commands used GOFLAGS=-mod=readonly -p=1; GOMAXPROCS=2 throughout. The focused new regression/control suite also passed three consecutive runs.
One use case is early asset preloading on a server-rendered page: send 103 with a CSS preload Link while loading data, then send the page or a final 503 if loading fails. Echo currently marks the hint as committed and drops that later error response; the real-HTTP regression covers this. This fixes the existing ResponseWriter path, rather than adding a new API, and was found through a compatibility check rather than a production incident.
Yes, the 103 must be a separate interim response in HTTP/1.1, as in RFC 8297's example. Go's WriteHeader(103) already sends that header block; this change stops Echo treating it as the final response, so the later status and body can still be sent. The tests cover that exchange over both HTTP/1.1 and HTTP/2; the patch does not enable hints automatically or assume every client supports them.
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
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.
Sending
103 Early Hintscurrently commits Echo's response, so a later explicit status or error response can be discarded. Keep informational responses provisional across the response, HEAD, gzip, and delayed JSON writers, while preserving101 Switching Protocolsas final.Validation limit: Local checks used Windows/amd64 with Go 1.27.1. Race testing could not run because CGO is disabled; other OS/Go configurations and upstream CI are unverified.
Implementation and validation
103followed by201sends a final200. Final regression tests also fail against exact base source via a Go overlay.net/http, including buffered gzip and delayed JSON paths.Passing local commands, with isolated caches and bounded concurrency:
Staticcheck: 2026.2.1. Golint: v0.0.0-20241112194109-818c5a804067. Lint commands used
GOFLAGS=-mod=readonly -p=1;GOMAXPROCS=2throughout. The focused new regression/control suite also passed three consecutive runs.