What's Changed
Behavior change: the all record mode
- Fix re-recording in the
allrecord mode (#1071, fixes #578 and #208):- A re-recorded interaction now replaces the interaction it matches. Before, the new one was saved next to the old one, and the stale response was replayed first on the next run.
- With
drop_unused_requests=True, the cassette is now replaced with only what was just recorded. Before, it was saved empty. - Behavior change: re-recording now removes every previously recorded interaction that matches a new one under your
match_onsetting. With loose matchers (e.g.match_on=["method"]), one new request can replace many old ones. Cassettes re-recorded inallmode also no longer accumulate responses across runs.
Fixes
- Fix httpx and httpx2 replay crashing on cassettes that store a null reason phrase, which includes cassettes recorded before 8.2.0 (#1028, #1029). Thanks @dgunning
- Fix bare-host URLs such as
https://example.comnot matching cassettes that recorded them ashttps://example.com/, a regression in 8.2.0 (#1013, #1031). Theurimatcher is otherwise as strict as before. Thanks @DSeaStar - Fix
AttributeError: 'VCRFakeSocket' object has no attribute 'gettimeout'when niquests reuses a pooled connection with urllib3-future 2.25.901 or later (#1056). Thanks @pylaterreur - Streaming (file-like or iterator) request bodies are now forwarded with
Content-Lengthinstead of chunked encoding, which some servers reject (#1002)
Maintenance
- CI: pin the PyPy jobs to PyPy 7.3, fix a flaky urllib3 test, bump actions/checkout to v7 and ruff to 0.17.1 (#1060, #1059, #1005, #1065). Thanks @pylaterreur
Full Changelog: v8.3.0...v8.4.0