Skip to content

fix(middleware): expose Flusher, Hijacker and Unwrap on the response wrapper - #43

Merged
rennf93 merged 1 commit into
masterfrom
fix/status-observer-interfaces
Oct 15, 2026
Merged

rennf93 merged 1 commit into
masterfrom
fix/status-observer-interfaces

Conversation

@rennf93

@rennf93 rennf93 commented Oct 15, 2026

Copy link
Copy Markdown
Member

Closes #42

The statusObserver response wrapper now implements Unwrap, Flush and Hijack.

  • Unwrap returns the underlying writer so http.NewResponseController reaches the deadline and full-duplex controls.
  • Flush pins the implicit 200 and delegates to the real writer, so SSE and other streaming handlers reach the client as they write. In held mode (a CustomResponseModifier is configured) the modifier must see the whole response, so Flush is a no-op there and the response is sent at release.
  • Hijack delegates to the underlying writer (http.ErrNotSupported when it cannot) and marks the connection as taken: the middleware then skips the response pass and the held-response release, so a hijacked connection is left alone.

Tests run against a real httptest server: an SSE handler whose first event must arrive before the handler returns, http.ResponseController.Flush, a raw hijack exchange with and without a modifier, and a held response that is still modified after a Flush.

@github-actions github-actions Bot added area: middleware Touches middleware.go or request.go (adapter core) tests Test suite changes labels Oct 15, 2026
@rennf93
rennf93 merged commit 9982a4f into master Oct 15, 2026
13 checks passed
@rennf93
rennf93 deleted the fix/status-observer-interfaces branch October 15, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: middleware Touches middleware.go or request.go (adapter core) tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Response wrapper hides http.Flusher, http.Hijacker and Unwrap

1 participant