Kommentar
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Standardkonfigurationsfil för Dev Proxy.
Dev Proxy stöder både JSON-format () och YAML-format (, ) för konfigurationsfiler. Standardfilen är , men Dev Proxy är även autodiscovers och .
Anmärkning
Schemaverifiering () gäller endast för JSON-baserade konfigurationsfiler. YAML-konfigurationsfiler verifieras inte mot scheman vid körning.
Fil: devproxyrc.json
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.2.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.2.0/genericrandomerrorplugin.schema.json",
"errorsFile": "devproxy-errors.json",
"rate": 50
},
"logLevel": "information",
"newVersionNotification": "stable",
"showSkipMessages": true,
"showTimestamps": true,
"validateSchemas": true
}
Fil: devproxyrc.yaml (motsvarande YAML-konfiguration)
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
YAML-konfigurationen stöder fästpunkter och sammanslagningsnycklar för återanvändbara konfigurationsblock:
# 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