Example 487

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": "Mitchell Murphy",
"email": "Domingo.Effertz23@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Mr. Austin Brekke",
"email": "General.Pollich@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "2553c041-3929-4587-8db9-4f84e1103f56"
}
delay_ms: 398 # simulated latency
}

See also