Skip to content

fix(tests): reset middleware order header per request (closes #533) - #545

Merged
s2x merged 2 commits into
masterfrom
fix/issue-533-middleware-triple-dispatch
Jul 3, 2026
Merged

fix(tests): reset middleware order header per request (closes #533)#545
s2x merged 2 commits into
masterfrom
fix/issue-533-middleware-triple-dispatch

Conversation

@s2x

@s2x s2x commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Closes #533

Changes

  • Reset the test middleware execution-order accumulator on the first middleware invocation so MiddlewareTest::testHeaders no longer sees a stale X-Test-Middleware-request-order value on subsequent keep-alive requests under macOS / Workerman
  • Added a regression test (testMiddlewareRequestHeadersDoNotLeakAcrossRequests) that performs two consecutive requests through the same HTTP client and asserts identical middleware order on both responses

Root cause

The test middleware (TestMiddleware) accumulated the X-Test-Middleware-request-order header across keep-alive requests because the request header state was never reset at the start of each request. On macOS / Workerman the second request received the accumulated value, causing testHeaders to see the chain 3× instead of 1×.

Changelog

Code Review

  • Passed subagent code review
  • All review comments addressed

@s2x
s2x merged commit e03c345 into master Jul 3, 2026
12 checks passed
@s2x
s2x deleted the fix/issue-533-middleware-triple-dispatch branch July 3, 2026 21:39
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.

[Bug] MiddlewareTest::testHeaders fails on macOS — middleware executes 3× instead of 1×

1 participant