Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
At a glance
Goal: Configure how often Dev Proxy simulates API failures
Time: 2 minutes
Prerequisites: Set up Dev Proxy
By default, there's 50% chance that Dev Proxy returns a random error for your API. You can change the likelihood to a different value using the --failure-rate option, for example:
devproxy --failure-rate 80
Alternatively, you can configure the failure rate in the Dev Proxy configuration file.
File: devproxyrc.json
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/rc.schema.json",
"plugins": [
{
"name": "GenericRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "genericRandomErrorPlugin"
}
],
"urlsToWatch": [
"https://api.example.com/*"
],
"genericRandomErrorPlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/genericrandomerrorplugin.schema.json",
"errorsFile": "errors.json",
"rate": 80
}
}
Important
When you configure the failure rate to 0, Dev Proxy will pass all requests through to the original API. When you configure it to 100, Dev Proxy will simulate an error for every matching request.
See also
- Test my app with random errors - Error simulation workflow
- Glossary - Dev Proxy terminology