Every response saves the time it took to call the downstream service in the _proxyResponseTime field. You can tell mountebank to automatically translate that into a wait behavior, which will add the same latency to the saved response. This is a useful technique during performance testing, where you want to virtualize downstream services but still want realistic latencies.

Let's create the following proxy configuration:

"stubs": [{
  "responses": [{
    "proxy": {
      "to": "http://origin-server.com",
      "addWaitBehavior": true
    }
  }]
}]

Next we'll send a request to our proxy imposter to create a new saved response:

GET / HTTP/1.1
Host: origin-server.com

If you look at the imposter configuration, you'll notice the new wait behavior. The value will be the same as the _proxyResponseTime field, which means that the saved response will add the same latency as the real service.

"stubs": [
  {
    "predicates": [],
    "responses": [{
      "is": {
        "statusCode": 200,
        ...
        "_proxyResponseTime": 219
      },
      "behaviors": [
        {
          "wait": 219
        }
      ]
    }]
  },
  {
    "responses": [{
      "proxy": {
        "to": "http://origin-server.com",
        "addWaitBehavior": true
      }
    }]
  }
]