Example 14089

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": "Eli Larson",
"email": "Lucas78@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Leta Powlowski",
"email": "Eric_Klocko@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "37e5cd9f-4b6d-4bc6-8272-452c780238fb"
}
delay_ms: 260 # simulated latency
}

See also