Problem
testrunner.HttpTestRunner creates and closes a new httptest.Server for every request. This prevents multi-request flows from preserving server lifecycle state and makes the runner unsuitable for persistent HTTP sessions.
Scope
- Reuse one
httptest.Server for the lifetime of an HttpTestRunner.
- Reuse one HTTP client so cookies and transport state persist across requests.
- Preserve dynamic
WithHandler and WithHandlerFunc behavior.
- Close the server automatically when the owning test completes.
Acceptance criteria
- Multiple requests through the same runner use the same server.
- Session cookies survive between requests.
- Existing simple route and handshake tests continue to pass.
- The runner has regression coverage for persistent server/session behavior.
Problem
testrunner.HttpTestRunnercreates and closes a newhttptest.Serverfor every request. This prevents multi-request flows from preserving server lifecycle state and makes the runner unsuitable for persistent HTTP sessions.Scope
httptest.Serverfor the lifetime of anHttpTestRunner.WithHandlerandWithHandlerFuncbehavior.Acceptance criteria