-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.yml
122 lines (122 loc) 路 2.95 KB
/
config.yml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: mocki
port: 3001
references:
- type: collection
id: users
data: [{ id: 'a', name: 'Alpha' }]
endpoints:
- path: /
method: get
responses:
- statusCode: 200
body:
message: Hello from Mocki
headers:
- name: content-type
value: application/json
- path: /conditional
method: get
behavior: conditional
responses:
- statusCode: 200
condition: # trigger if authorization header equals 'valid'
operator: eq
comparand: headers.authorization # for query parameters: query.prop, for path parameters: params.prop
value: valid
body:
message: valid header
headers:
- name: content-type
value: application/json
- statusCode: 401
condition: # trigger if authorization header equals 'invalid'
operator: eq
comparand: headers.authorization
value: invalid
body:
message: invalid header
headers:
- name: content-type
value: application/json
- path: /conditional/:id
method: get
behavior: conditional
responses:
- statusCode: 200
condition:
operator: eq
comparand: params.message
value:
body:
message: param value was a
headers:
- name: content-type
value: application/json
- statusCode: 200
condition:
operator: eq
comparand: query.message
value: b
body:
message: param value was b
headers:
- name: content-type
value: application/json
- path: /random
method: get
behavior: random
responses:
- statusCode: 200
body:
number: 1
headers:
- name: content-type
value: application/json
- statusCode: 200
body:
number: 2
headers:
- name: content-type
value: application/json
- path: /fake
method: get
responses:
- statusCode: 200
body:
firstName: !Fake firstName
lastName: !Fake lastName
email: !Fake email
address: !Fake streetAddress
phone: !Fake phoneNumber
createdAt: !Fake pastDate
company: !Fake company
headers:
- name: content-type
value: application/json
- path: /delay
method: get
responses:
- statusCode: 200
delay: 500
body:
message: delayed by 500 ms
headers:
- name: content-type
value: application/json
- path: /collection
method: get
responses:
- statusCode: 200
body:
$ref:
type: collection
id: users
- path: /collection/:id
method: get
responses:
- statusCode: 200
body:
$ref:
type: collection
id: users
find: id