Example 9393

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": "Doris Ziemann",
"email": "Madeline.Goodwin47@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Emily Monahan",
"email": "Teagan_Lueilwitz92@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "e542ed61-3feb-46f0-aac9-83fc9a9c4619"
}
delay_ms: 257 # simulated latency
}

See also