Example 8485

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": "Prudence West",
"email": "Jeff_Kreiger73@yahoo.com",
"role": "admin"
},
{
"id": 2,
"name": "Delfina Haley",
"email": "Jon66@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "b3e480a5-56c9-49be-8b6b-8b6a57c20405"
}
delay_ms: 465 # simulated latency
}

See also