This handler passes requests through to the actual endpoint, then captures the response
and saves it as a snapshot file. This enables recording real API responses for later
replay during testing.Use this handler during an initial recording phase to capture responses from third-party
APIs, then use ResponseSnapshotReplayHandler to replay those responses
during test execution without hitting live endpoints.
// Create a handler that captures responses to snapshot filesvar innerHandler = new HttpClientHandler();var captureHandler = new ResponseSnapshotCaptureHandler("TestData/Snapshots"){ InnerHandler = innerHandler};var client = new HttpClient(captureHandler);// Requests go to the real endpoint, responses are saved as snapshotsvar response = await client.GetAsync("https://api.example.com/users");