Documentation
¶
Overview ¶
Command recordfixtures re-records testdata/fixtures from a live Payload instance.
go run ./tools/recordfixtures -base http://localhost:3900 -key <API-KEY> -out testdata/fixtures make fixtures # the same thing, from PAY_TEST_BASE_URL / PAY_TEST_API_KEY
Why a tool and not a shell script of curl calls:
- Every recording goes through internal/payload's real client, so a fixture is by construction the bytes the CLI would actually have received — including the Accept-Language header, the retry policy and the api_path resolution. A fixture recorded by curl can silently differ from what the program sees.
- Every body is passed through internal/redact before it touches the disk. A Payload project with useAPIKey returns the API key in plaintext from GET /{auth}/me (§7.8.3), so "record the response" and "commit the response" are not the same operation, and the difference must not be a human's discipline.
- Recording the ERROR fixtures requires deliberately provoking six specific failures. Their exact bodies are §11.2's whole subject, and they are exactly the thing nobody re-derives by hand a year later.
The tool is idempotent: it rewrites every fixture it can record and leaves the rest alone, so `git diff testdata/fixtures` is the answer to "has Payload changed under us".
Click to show internal directories.
Click to hide internal directories.