Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
File konfigurasi Proksi Dev Default.
Dev Proxy mendukung format JSON () dan YAML (, ) untuk file konfigurasi. File defaultnya adalah , tetapi Dev Proxy juga autodiscover dan .
Nota
Validasi skema () hanya berlaku untuk file konfigurasi berbasis JSON. File konfigurasi YAML tidak divalidasi terhadap skema saat runtime.
File: devproxyrc.json
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.4.0/rc.schema.json",
"plugins": [
{
"name": "RetryAfterPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
},
{
"name": "GenericRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "genericRandomErrorPlugin"
}
],
"urlsToWatch": [
"https://jsonplaceholder.typicode.com/*"
],
"genericRandomErrorPlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.4.0/genericrandomerrorplugin.schema.json",
"errorsFile": "devproxy-errors.json",
"rate": 50
},
"logLevel": "information",
"newVersionNotification": "stable",
"showSkipMessages": true,
"showTimestamps": true,
"validateSchemas": true
}
File: devproxyrc.yaml (konfigurasi YAML yang setara)
plugins:
- name: RetryAfterPlugin
enabled: true
pluginPath: "~appFolder/plugins/DevProxy.Plugins.dll"
- name: GenericRandomErrorPlugin
enabled: true
pluginPath: "~appFolder/plugins/DevProxy.Plugins.dll"
configSection: genericRandomErrorPlugin
urlsToWatch:
- "https://jsonplaceholder.typicode.com/*"
genericRandomErrorPlugin:
errorsFile: devproxy-errors.json
rate: 50
logLevel: information
newVersionNotification: stable
showSkipMessages: true
showTimestamps: true
validateSchemas: true
Konfigurasi YAML mendukung jangkar dan menggabungkan kunci untuk blok konfigurasi yang dapat digunakan kembali:
# Define reusable response templates using YAML anchors
throttled: &throttled
statusCode: 429
body: '{"error": "Too many requests"}'
mocks:
- request:
url: https://api.example.com/users
response:
<<: *throttled
- request:
url: https://api.example.com/groups
response:
<<: *throttled