Parity tests: Handle request-body mutation
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 13
- Forks
- 40
- Avg merge
- 12h 17m
- Merged PRs (30d)
- 156
Description
The parity suite doesn't exercise plugin-driven body mutation. A plugin that rewrites the request body via pctx.SetBody (declaring WritesRequestBody: true) has its output travel to the upstream through completely different code paths on each listener — Envoy's BodyMutation proto message for extproc, direct Request.Body replacement for the proxies.
Why it matters
- A rewrite that lands on the wire on one listener and gets dropped on the other is silent — the pipeline plugin sees success, upstream sees the original bytes, only one deployment shape misbehaves.
- Header rewrites (Content-Length, Content-Type) accompanying a body change follow a separate encoding path per listener and can drift independently from the body itself.
- The
tool-pruneplugin depends on this exact contract in production; without a parity fixture, its behavior across deployment shapes is asserted only by end-to-end tests.
Fix
Add a mutateRequestBody []byte knob to spyConfig. When set, spyPlugin.OnRequest calls pctx.SetBody(cfg.mutateRequestBody) and the fixture:
- Declares
WritesRequestBody: trueinCapabilities. - Asserts the upstream (
httptest.Serveron the proxy path, mock stream response on extproc) receives the mutated bytes verbatim on both listeners. - Asserts the mutated Content-Length reaches upstream headers consistently.
Depends on the ReadsBody fixture landing first (#937) since request-body mutation shares the two-phase handshake plumbing.
Follow-up from #935.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the parity suite's spyConfig and spyPlugin.OnRequest entry points, then inspect the existing ReadsBody fixture and dependency on #937. Add coverage for SetBody with WritesRequestBody enabled, verifying that both listener paths deliver the mutated bytes and matching Content-Length to their upstreams.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100