Mocks
Intercept outbound HTTP requests from your services and return controlled responses.
Required fields
| Field | Type | Description |
type | "MOCK" | Item type |
name | string | Unique name (1-63 chars) |
mockTarget | string | Target hostname to intercept (e.g., api.stripe.com) |
mockPath | string | URL path to match (e.g., /v1/charges, /api/*) |
Optional fields
| Field | Type | Default | Description |
description | string | — | Human-readable description (max 500 chars) |
mockMethod | enum | * | HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, or * (any) |
mockOrigin | string | any | Service name that makes the request, or * for any |
mockDelayMs | integer | — | Artificial response delay in milliseconds |
mockResponseStatus | integer | — | HTTP response status code (100-599) |
mockResponseHeaders | object | — | Response headers |
mockResponseBody | any JSON | — | Response body |
Example — mocking Stripe
{
"type": "MOCK",
"name": "mock-stripe-charges",
"mockMethod": "POST",
"mockOrigin": "payment-service",
"mockTarget": "api.stripe.com",
"mockPath": "/v1/charges",
"mockDelayMs": 100,
"mockResponseStatus": 200,
"mockResponseHeaders": { "Content-Type": "application/json" },
"mockResponseBody": {
"id": "ch_test_123",
"object": "charge",
"amount": 2000,
"currency": "usd",
"status": "succeeded"
}
}
Example — mocking a failure
{
"type": "MOCK",
"name": "mock-stripe-failure",
"mockMethod": "POST",
"mockTarget": "api.stripe.com",
"mockPath": "/v1/charges",
"mockResponseStatus": 402,
"mockResponseBody": {
"error": { "type": "card_error", "message": "Your card was declined." }
}
}
Alternative: top-level mocks array
Mocks can also be defined in a top-level mocks array on the definition, with shorter field names:
{
"name": "my-definition",
"items": [ ... ],
"mocks": [
{
"name": "Stripe Create Charge",
"method": "POST",
"origin": "payment-service",
"target": "api.stripe.com",
"path": "/v1/charges",
"responseStatus": 200,
"responseHeaders": { "Content-Type": "application/json" },
"responseBody": { "id": "ch_test", "status": "succeeded" }
}
]
}
Field name mapping
| Item field | Mocks array field |
mockMethod | method |
mockOrigin | origin |
mockTarget | target |
mockPath | path |
mockDelayMs | delayMs |
mockResponseStatus | responseStatus |
mockResponseHeaders | responseHeaders |
mockResponseBody | responseBody |