-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmock_endpoints.example.json
More file actions
101 lines (101 loc) · 2.51 KB
/
mock_endpoints.example.json
File metadata and controls
101 lines (101 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{
"server": {
"host": "0.0.0.0",
"port": 8080
},
"response_flags": ["example-env"],
"routes": [
{
"method": "GET",
"path": "/users",
"description": "Returns a list of demo users.",
"status": 200,
"response_flags": ["users-base"],
"body": {
"users": [
{ "id": 1, "name": "Ada" },
{ "id": 2, "name": "Linus" }
]
},
"variants": [
{
"description": "Filtered list when ?team=platform&active=true",
"query": {
"team": "platform",
"active": "true"
},
"response_flags": ["users-filtered"],
"body": {
"users": [
{ "id": 42, "name": "Grace" }
]
}
},
{
"description": "Empty list for ?team=support",
"query": {
"team": "support"
},
"request_flags": ["beta-list"],
"response_flags": ["users-beta"],
"body": {
"users": []
}
},
{
"description": "Error when ?team=ops",
"query": {
"team": "ops"
},
"status": 503,
"text_body": "team backend currently unavailable"
}
],
"error_variants": [
{
"name": "users-timeout",
"description": "Force a temporary outage via ?__error=users-timeout or header x-api-faker-error",
"status": 503,
"delay_ms": 1500,
"text_body": "upstream dependency unavailable"
},
{
"name": "users-unauthorized",
"description": "Simulate an authorization error",
"status": 401,
"headers": {
"WWW-Authenticate": "Bearer realm=mock"
},
"text_body": "missing or invalid token"
}
]
},
{
"method": "POST",
"path": "/users",
"description": "Pretend to create a new user.",
"status": 201,
"body": {
"id": 999,
"message": "User created"
}
},
{
"method": "GET",
"path": "/reports/slow",
"description": "Simulates a slow endpoint for testing loading states.",
"status": 200,
"delay_ms": 1200,
"body": {
"status": "still crunching numbers"
}
},
{
"method": "DELETE",
"path": "/jobs/42",
"description": "Returns a simple confirmation as plain text.",
"status": 202,
"text_body": "Job 42 scheduled for deletion"
}
]
}