RateLimitingPlugin

模拟速率限制行为。

命令提示符的屏幕截图,其中开发人员代理模拟 GitHub API 上的速率限制。

插件实例定义

{
  "name": "RateLimitingPlugin",
  "enabled": false,
  "pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
  "configSection": "rateLimiting"
}

配置示例

{
  "rateLimiting": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.27.0/ratelimitingplugin.schema.json",
    "costPerRequest": 2,
    "rateLimit": 120
  }
}

配置属性

财产 描述 违约
headerLimit 传达速率限制限制的响应标头的名称 RateLimit-Limit
headerRemaining 在重置之前传达剩余资源数的响应标头的名称 RateLimit-Remaining
headerReset 响应标头的名称,该标头传达重置前剩余时间 RateLimit-Reset
headerRetryAfter 传达重试后句点的响应标头的名称 Retry-After
costPerRequest 请求成本的资源数 2
resetTimeWindowSeconds 下一次重置的时长(以秒为单位) 六十
warningThresholdPercent 超出时间开始返回速率限制响应标头的使用量百分比 80
rateLimit 时间窗口的资源数 120
whenLimitExceeded 超出限制时插件应使用的行为。 使用 ThrottleCustom Throttle
resetFormat 用于确定速率限制何时重置的格式。 使用 SecondsLeftUtcEpochSeconds SecondsLeft
customResponseFile 包含超出限制时使用的自定义错误响应的文件。 rate-limit-response.json

命令行选项

没有

后续步骤