Echo the request back

Reflect the incoming method, headers, and body into the response with {{request.*}} tokens.

When to use this

Sometimes you need an endpoint that mirrors whatever it receives — to debug what your client actually sends, or to fake an API whose response depends on the request. The {{request.body}}, {{request.method}}, and {{request.header.*}} tokens echo the incoming request straight into the response.

Create the mock

curl -X POST https://quickmock.dev/api/mocks \
  -H 'Content-Type: application/json' \
  -d '{
  "method": "POST",
  "content_type": "application/json",
  "response_body": "{\"you_sent\":{{request.body}},\"method\":\"{{request.method}}\",\"trace\":\"{{request.header.x-request-id}}\"}"
}'

Call it

curl -X POST -H 'X-Request-Id: abc-123' -H 'Content-Type: application/json' -d '{"a":1}' https://quickmock.dev/m/<slug>

What you get

{"you_sent":{"a":1},"method":"POST","trace":"abc-123"}

Build your own

Create a mock

← All guides