Skip to content

fix(middleware): apply the custom response modifier and refresh stale docs - #41

Merged
rennf93 merged 1 commit into
masterfrom
parity/adapter-parity
Oct 15, 2026
Merged

rennf93 merged 1 commit into
masterfrom
parity/adapter-parity

Conversation

@rennf93

@rennf93 rennf93 commented Oct 15, 2026

Copy link
Copy Markdown
Member

Closes #40

I wired Engine.ModifyResponse into the pass-through path in the order the reference applies it (security headers, CORS, modifier, then CORS again). The status was already observed correctly. I also removed the stale examples and docs claims that the default address headers need a manual ExcludedDetectionHeaders entry and that EnableAgent fails validation; I verified both against the current engine, with a test pinning the header claim.

With a modifier configured the adapter holds the whole handler response in memory until the handler returns, so streamed responses are delivered at the end. Without a modifier nothing changes. Hijacked connections are left alone. I added real-framework tests that fail on master (modifier ignored, modifier not seeing CORS, wrong status) and pass now, and the repo gate is green: gofmt, vet, staticcheck, unit and integration tests with Redis, and the 100% coverage gate. The engine API used (ModifyResponse) is already in the released v4.3.2 floor, so no dependency change.

prest-guard builds on this adapter, so it picks the modifier up once this is released. I did not change the unknown-client-address behavior: the reference answers 403 "Client address could not be determined" under fail_secure in handle_passthrough, but Engine.Check in guard-core-go has no such step (only GuardWebSocket does), so that fix belongs in the engine.

… docs

The adapter now holds the handler response when CustomResponseModifier is configured and runs Engine.ModifyResponse last, then re-applies CORS, matching the reference process_response.

The examples and docs no longer tell users to mirror the default address-header exclusion or to avoid EnableAgent: the current engine covers the headers by default and EnableAgent validates. Closes #40
@github-actions github-actions Bot added documentation Docs, README, governance files area: middleware Touches middleware.go or request.go (adapter core) tests Test suite changes examples Example application changes labels Oct 15, 2026
@rennf93
rennf93 merged commit 339bf5d into master Oct 15, 2026
13 checks passed
@rennf93
rennf93 deleted the parity/adapter-parity branch October 15, 2026 11:58
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) documentation Docs, README, governance files examples Example application changes tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: apply CustomResponseModifier to pass-through responses and refresh stale docs

1 participant