Post-response scripts
A post-response script runs after the response arrives — the last script step of the send pipeline. It can:
- read the response: status, headers, body, timing, size, and parsed JSON/XML (
fp.response.*); - read and write environment variables (
fp.environment.get/set), persisted after the send; - read the ephemeral per-send scratch space set by the pre-request script (
fp.variables.get); - emit logs (
fp.log/warn/error); and - run tests (
fp.test,fp.expect).
It cannot modify the request — that ship has sailed once the response is back.
const body = fp.response.json();fp.environment.set('userId', body.id);fp.test('created', () => fp.expect(fp.response.status).to.equal(201));Scripts run inside an isolated, synchronous sandbox with a single global, fp. See the
execution model for the full API and its constraints.
The sandbox guards against accidental footguns, but it is not designed to contain a malicious
script. Treat a .http file from an untrusted source the way you would treat a shell script from the
same source: read it before running it.