Skip to content

Latest commit

 

History

History
39 lines (32 loc) · 977 Bytes

simulate-slow-api-responses.md

File metadata and controls

39 lines (32 loc) · 977 Bytes
title description author ms.author ms.date
Simulate slow API responses
How to simulate slow API responses
garrytrinder
garrytrinder
01/25/2024

Simulate slow API responses

Dev Proxy allows you to simulate slow API responses by using the LatencyPlugin.

Start, by enabling the plugin in your Dev Proxy configuration file:

{
  "$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.14.1/rc.schema.json",
  "plugins": [
    {
      "name": "LatencyPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
      "configSection": "latencyPlugin"
    }
  ],
  "urlsToWatch": []
}

Next, specify the minimum and maximum delay (in milliseconds) to simulate for your API.

"latencyPlugin": {
  "minMs": 200,
  "maxMs": 10000
}

When a response is delayed, Dev Proxy displays the total duration it was delayed for in the console output.