Example 6583

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": "Terrence Bernier",
"email": "Aaron82@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Jessie Ferry",
"email": "Sigurd.Wolf@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "f3e014ba-0a86-4e4f-bc98-6f4e1aca4872"
}
delay_ms: 291 # simulated latency
}

See also