mirror: regression-test that the probe drains its body for conn reuse

main

Commit

Soph3mo ago

Inject the *http.Client into mirrorAdvertisesHead (caller passes probeClient) so the test can use an isolated, parallel-safe idle pool instead of the package global.

The test serves a non-200 with a non-empty body — the function returns at the status check without reading the body, so the deferred drain is the only thing that consumes it. Counting StateNew transitions across five probes asserts they share one connection; removing or under-capping the drain leaves the body partially read and the count jumps to five.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: ab3b94a4fb5a

Checkpoints

HTTP Connection Reuse and Probe Draining

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1