Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lsymds opened this issue Nov 11, 2022 · 9 comments

Comments

@lsymds
Copy link

lsymds commented Nov 11, 2022

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.

@ageddesi
Copy link
Owner

This sounds like a great idea.

@bugrakocabay
Copy link

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

@ageddesi
Copy link
Owner

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

@0xVnay
Copy link

0xVnay commented Apr 3, 2023

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

@ageddesi
Copy link
Owner

ageddesi commented Apr 3, 2023

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

@ageddesi
Copy link
Owner

Removing @0xVnay from the assignee due to inactivity

suppergerrie2 added a commit to suppergerrie2/Mocked-API that referenced this issue Oct 1, 2023
suppergerrie2 added a commit to suppergerrie2/Mocked-API that referenced this issue Oct 1, 2023
@ageddesi
Copy link
Owner

ageddesi commented Oct 2, 2023

Will be in next release

@ageddesi ageddesi closed this as completed Oct 2, 2023
@ageddesi
Copy link
Owner

ageddesi commented Oct 4, 2023

@all-contributors please add @suppergerrie2 for code

@allcontributors
Copy link
Contributor

@ageddesi

I've put up a pull request to add @suppergerrie2! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants