Example 4590

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": "Ludie Huel",
"email": "Annette19@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Seth Wilderman",
"email": "Inez20@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "3edc7789-bdf4-4dd4-a638-4c43a676e956"
}
delay_ms: 229 # simulated latency
}

See also