40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
#!api-testing-mock
|
|
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-mock-schema.json
|
|
items:
|
|
- name: prList
|
|
request:
|
|
path: /api/v1/repos/{repo}/prs
|
|
response:
|
|
header:
|
|
server: mock
|
|
content-type: application/json
|
|
body: |
|
|
{
|
|
"count": 1,
|
|
"items": [{
|
|
"title": "fix: there is a bug on page {{ randEnum "one" "two" "three" "four" }}",
|
|
"number": {{randInt 100 199}},
|
|
"float": {{randFloat 0.0 1.0}},
|
|
"status": "{{randWeightEnum (weightObject 4 "open") (weightObject 1 "closed")}}",
|
|
"message": "{{.Response.Header.server}}",
|
|
"author": "{{env "USER"}}",
|
|
"created": "{{ now.Format "2006-01-02T15:04:05Z07:00" }}"
|
|
}],
|
|
"uptime": "{{uptime}}"
|
|
}
|
|
- name: base64
|
|
request:
|
|
path: /api/v1/base64
|
|
response:
|
|
body: aGVsbG8=
|
|
encoder: base64
|
|
- name: baidu
|
|
request:
|
|
path: /v1/baidu
|
|
response:
|
|
body: https://baidu.com
|
|
encoder: url
|
|
proxies:
|
|
- path: /api/v1/{part}
|
|
target: http://atest.localhost:8080
|