When using CreateTestContext directly to test handlers, ctx.Status()
sets the status internally but it is not flushed to the underlying
httptest.ResponseRecorder. RunTestHandler creates a test context, runs
the handler chain, and calls WriteHeaderNow() so that the status code
is properly reflected in the ResponseWriter.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Implement TestRebuild404Handlers to verify 404 handler chain rebuilding
when global middleware is added via Use()
- Add waitForServerReady helper with exponential backoff to replace
unreliable time.Sleep() calls in integration tests
- Fix race conditions in TestRunEmpty, TestRunEmptyWithEnv, and
TestRunWithPort by using proper server readiness checks
- All tests now pass consistently with -race flag
This addresses the empty test function and eliminates flaky test failures
caused by insufficient wait times for server startup.
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>