Example 2082

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": "Ms. Patricia Bins",
"email": "James37@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Janae Bogisich",
"email": "Amie_Nader78@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "d878a47e-965e-4458-86dc-0038e433f722"
}
delay_ms: 86 # simulated latency
}

See also