Example 12883

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": "Russell Willms",
"email": "Margarett14@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Jane Towne Jr.",
"email": "Lorenzo90@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "437bcfbc-1201-49a4-b825-6233b295e390"
}
delay_ms: 251 # simulated latency
}

See also