Skip to content

Using Response Overrides

Inspectr supports special headers that let you override the response behavior for a request. This is helpful when you’re testing edge cases, simulating failures, or customizing mock data on the fly.

This guide covers how to use response override headers and what they do.


  • Simulate network latency
  • Force specific HTTP status codes (e.g. 404, 500)
  • Choose a specific example in your OpenAPI spec
  • Override the Content-Type of a response

Overrides work in:

  • Mock mode (with --mock-backend)
  • Catch mode (with --catch=true)

HeaderDescription
inspectr-response-statusOverride the HTTP status code (e.g. 404, 503)
inspectr-response-delayDelay response in milliseconds (e.g. 2000 = 2s delay)
inspectr-response-exampleReturn a specific OpenAPI example by name
inspectr-response-content-typeOverride the Content-Type header in the response
inspectr-tagTag a request with one or more values (e.g. billing, user:123)

Terminal window
curl http://localhost:8080/api/items \
-H "inspectr-response-status: 503" \
-H "inspectr-response-delay: 3000"

This simulates a 3-second server outage with a 503 Service Unavailable status.


Your OpenAPI spec includes this:

examples:
validList:
summary: A list of valid items
value:
items: ["A", "B", "C"]
emptyList:
summary: An empty list
value:
items: []

Use this header to select emptyList:

Terminal window
curl http://localhost:8080/api/items \
-H "inspectr-response-example: emptyList"

Terminal window
curl http://localhost:8080/api/submit \
-H "inspectr-response-status: 404"

This returns a 404 Not Found response regardless of the mock or catch behavior.


Force a different Content-Type in the response:

Terminal window
curl http://localhost:8080/echo \
-H "inspectr-response-content-type: text/plain"

Apply simple or key/value tags that downstream tooling can read:

Terminal window
curl http://localhost:8080/api/items \
-H "inspectr-tag: billing, user:123"

You can send multiple inspectr-tag headers to attach several tags to the same request, or use the key:value pattern for structured tagging.

As you collect responses or webhooks, tags give you lightweight metadata that can help you bundle and mark operations, giving them additional context. These tags can be used for filtering in the history and for statistic insights.

Some use-cases:

  • QA test runs – Mark exploratory sessions (e.g. inspectr-tag: qa:test-run-42) so logs and analytics are easy to filter when triaging bugs.
  • Environment targeting – Compare request data and how the API services behave differently (e.g. inspectr-tag: env:staging) between dev/staging/prod environments.
  • Version tracking – Capture which app or API version triggered the request (e.g. inspectr-tag: client-version:2.3.1) when validating compatibility.

The `inspectr-tag” is never forwarded to the connected service, so your requests stay untouched. It is a powerful option to use for observability use-cases, comparing statistics on the dashboard or reviewing the request history with the extra context.


Response overrides help you simulate different scenarios without changing your backend or OpenAPI file. They’re great for testing, mocking, and QA validation workflows.