Example 15497

API Mock

Mock API response payloads for testing.

# Mock API definition
{
endpoint: "/api/v1/users"
method: "GET"
status: 200
# JSON response body
response: """
[
{
"id": 1,
"name": "Stephanie Casper",
"email": "Enrique.Rodriguez73@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Theresa Lindgren",
"email": "Alysa_Flatley@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "d6eab7fa-4179-437e-b20d-09f4cd54aeb1"
}
delay_ms: 471 # simulated latency
}

See also