Aracılığıyla paylaş


devproxyrc

Varsayılan Dev Proxy yapılandırma dosyası.

Dev Proxy, yapılandırma dosyaları için hem JSON () hem de YAML (, ) biçimlerini destekler. Varsayılan dosya olur, ancak Dev Proxy de ve otomatik bulmalarını sağlar.

Uyarı

Şema doğrulaması () yalnızca JSON tabanlı yapılandırma dosyaları için geçerlidir. YAML yapılandırma dosyaları çalışma zamanında şemalara karşı doğrulanmaz.

Dosya: 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
}

Dosya: devproxyrc.yaml (eşdeğer YAML yapılandırması)

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 yapılandırması, yeniden kullanılabilir yapılandırma blokları için tutturucuları ve birleştirme anahtarlarını destekler:

# 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