ageddesi/Mocked-API

Endpoint that randomly succeeds/fails based on a configuration sent in the request

lsymds opened this issue · 9 comments

Is your feature request related to a problem? Please describe.
I'd like an endpoint that randomly succeeds or fails based on a configuration I can send in the request.

Describe the solution you'd like
There's many possible ways this could be implemented, ranging from a simple randomly failing endpoint with a randomness factor (i.e. api/flaky?failure_rate=0.25) to a more in depth endpoint that takes a configuration object on how it should and/or could potentially respond:

{
    "successes": {
       200: 50
    },
   "failures": {
      400: 25,
      403: 10,
      404: 15
   }
}

In the example above, there's a 50% chance of succeeding with a 200 OK response, a 25% chance of failing with a 400 BAD REQUEST, a 10% chance of failing with a 403 FORBIDDEN and a 15% chance of failing with a 404 NOT FOUND.

Naturally the latter will require some more work.

This sounds like a great idea.

I would like to implement this idea, if no one is already doing so.

Hi @bugrakocabay this is all yours. :)
please do reach our on our discord channel if you need any help. https://discord.gg/7esAwBqY

Hello @ageddesi. If no one is assigned to this issue, I would love to work on it.

Hi @0xVnay,
Awesome. Welcome and if you need any help please reach out on the discord channel.
https://discord.gg/YCSKM6wz

Removing @0xVnay from the assignee due to inactivity

Will be in next release