gstroup / apimocker

node.js module to run a simple http server for mock service responses.
MIT License
280 stars 81 forks source link

How about support for randomizing responses for the same query ? Is this already supported ? #15

Closed pvenkatakrishnan closed 6 years ago

pvenkatakrishnan commented 10 years ago

If not, i'd like to take a stab at it :)

gstroup commented 10 years ago

There is currently no support for returning randomized responses for a single query. Just curious, what would be the use case, where you want random responses? If you'd like to take a stab at it, that would great. Pull requests welcome!

pvenkatakrishnan commented 10 years ago

Could be the case where i want to simulate a 200 vs 500s . personally i am trying to generate a report of the service performance and trying to mock for the same. It helps if i can keep pinging with the exact same request and get a different response at various times.

gstroup commented 10 years ago

I see. The only way to do that currently, is by calling the /admin/setMock API from your test script. You could tell apimocker to return a 200 for a certain request. Then call /admin/setMock again later to tell apimocker to return a 500.

pvenkatakrishnan commented 10 years ago

ok let me try that.

gstroup commented 6 years ago

Closing due to age of the issue. Please let me know if this is still desired, and we can re-open the issue.