mdasberg / ng-apimock

Node plugin that provides the ability to use scenario based api mocking: for local development for protractor testing
MIT License
99 stars 26 forks source link

Please add functionality to add a delay by default #20

Closed sandervalstar closed 7 years ago

sandervalstar commented 7 years ago

In tests it's possible to set a delay with the delayResponse function, however during development I can only add a delay to a mocked endpoint manually on the /mocking page. I would like to add a small delay to some endpoints by default so it's easy to see during development that the loading spinners still work.

I would propose an optional "delay" or "delayResponse" field to the responses like illustrated below.

{
  "expression": "todo\/.*",
  "method": "GET",
  "name": "getTodo",
  "isArray": false,
  "responses": {
    "successful": {
      "default": true,
      "status": 200,
      "delay": 500
    }
  }
}
wswebcreation commented 7 years ago

Hi @sandervalstar

Tnx for your suggestion, if you have time for it you may also add a PR for it :)

mdasberg commented 7 years ago

@sandervalstar I just implemented the change you suggested. When the build is successful, I will create a release.

sandervalstar commented 7 years ago

That's awesome! Thanks a lot!

mdasberg commented 7 years ago

v1.3.0 has been released

sandervalstar commented 7 years ago

Just upgraded and it works, thanks again!