Fixes #1681.
The proxy replay parser strips the captured body before applying request modifications. A replay that changes only a header can therefore change the payload as well. For example, b" value \r\n" becomes b"value".
Preserve the text after the HTTP header separator. The existing replay logic still handles explicit replacement bodies and recomputes Content-Length from the serialized payload.
The regression drives both the host and sandbox replay entry points with Caido's get/create/send calls stubbed. Ten cases fail on unchanged 06015506 and eight controls pass. After the fix, all 42 proxy and Caido tests pass. Ruff format/lint and diff checks pass on Python 3.12.14 with the frozen dependency set. The tests use synthetic requests. Live Caido and Docker integration remain unverified.
[Medium impact] The PR appears safe to merge.
Summary
Preserves leading and trailing whitespace in captured text bodies when requests are replayed.
No actionable issues found. Tests were inspected but not run during this review.
Reviews (1) · Last reviewed commit: "fix(proxy): preserve whitespace in repla..." · Reviewed by Greptile