-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.yml
70 lines (70 loc) · 1.58 KB
/
routes.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
GET /api/v1/account:
bypass: false
delay: 1000
code: 200
headers:
Content-Type: "application/json"
Server: "Nginx"
body: |-
{
"name": "admin"
}
PUT /api/v1/account:
bypass: false
delay: 0
code: 200
headers:
Content-Type: "application/json"
Server: "Nginx"
ALL /api/v1/proxy/*:
proxy:
remote: 'https://jsonplaceholder.typicode.com'
rewrite: ^/api/v1/proxy/(.*) /posts/$1
headers:
X-Real-IP: $remote_addr
X-Forwarded-For: $proxy_add_x_forwarded_for
X-Mockit-Proxy: 'true'
Upgrade: $http_upgrade
User-Agent: $http_user_agent
Connection: 'upgrade'
Host: $host
GET /api/v1/users/:id:
code: 200
headers:
Content-Type: "application/json"
body: |-
{
"id": 0,
"name": "unknown"
}
cond:
- case: params.id == 1
body: |-
{
"id": 1,
"name": "Alfonzo"
}
- case: params.id == 2
body: |-
{
"id": 2,
"name": "Juanita"
}
GET /api/v1/members/:id:
code: 200
headers:
Content-Type: "application/json"
body: |-
{
"index": ${params.id},
"uid": ${faker.random.number() + params.id},
"name": "${faker.internet.userName()}",
"fullname": "${$faker('zh_CN').name.firstName}${$faker('zh_CN').name.lastName()}",
"email": "${faker.internet.email}",
"location": {
"latitude": ${faker.address.latitude},
"longitude": ${faker.address.longitude}
},
"desc": "${faker.lorem.paragraph}",
"escape": "${'\{' + 'using curly braces inside interpo template' + '\}'}"
}