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

Allow setting different responses per request (repeats) #31

Open
joanlopez opened this issue Oct 14, 2019 · 9 comments
Open

Allow setting different responses per request (repeats) #31

joanlopez opened this issue Oct 14, 2019 · 9 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest idea
Milestone

Comments

@joanlopez
Copy link
Member

Context

A quite common feature on some of the mock servers of the market is the possibility to define a different response for each time an imposter is requested.

It basically will consists on returning the response A the first X times the imposter is requested, then returning the response B the next times and so on (as much flexible as possible).

Proposed implementation

As this is an issue tagged as just an idea, there's no implementation proposal.
Then, there's a single requirement: to keep Killgrave as simple as possible.

Example

Just as a proposal example,

It could be implemented by changing the response section (within imposter) from an object to an array of objects, adding to each of them a field times (or named similar) that would allow the user to set those different responses for each request.

However, it's entirely open, so feel free to write down a comment with your point-of-view and to start the discussion.

@spinales
Copy link

spinales commented Sep 30, 2020

Hi, I think it could be done, define an arrangement with a series of predefined responses around 2 to 4, and then send them randomly :)

@joanlopez
Copy link
Member Author

Hey,

Yup, we're completely open to suggestions. Maybe we can define multiple response mechanisms.
IMHO, both (the one defined on the issue description and the one you mentioned) can coexist.

What do you think? 🤔
cc/ @aperezg

@spinales
Copy link

spinales commented Oct 3, 2020

@aperezg You could assign it to me, I would like to keep trying?

@aperezg aperezg linked a pull request Oct 4, 2020 that will close this issue
@spinales
Copy link

spinales commented Oct 7, 2020

@aperezg Could you tell me an idea of how the user could choose the option he wants, I came to think of creating a sub endpoint so to speak but I think it would break the simple scheme that killgrave wants to maintain

@joanlopez joanlopez assigned joanlopez and unassigned spinales Feb 13, 2021
@infinite-spectrum
Copy link

@joanlopez is this issue still open?
I'd like to start working on this one but I see in the documentation that we support dynamic responses and this issue is still open.

@joanlopez
Copy link
Member Author

joanlopez commented Jun 19, 2021

@joanlopez is this issue still open?
I'd like to start working on this one but I see in the documentation that we support dynamic responses and this issue is still open.

Yes, this issue is still open because though Killgrave allows you to set up dynamic responses based on request's matching rules, you cannot set up dynamic responses for one specific set of matching rules.

You can look at the aforementioned PR comments from @aperezg to get additional context.

@infinite-spectrum
Copy link

I've done some work on the above feature request. I've added changes related information in the PR's comment.
@joanlopez and/or @aperezg, can you please take a look?

Here's a link to my PR

@vivekprm
Copy link

Is it still open? Would like to work on it.

@joanlopez
Copy link
Member Author

joanlopez commented Jul 26, 2023

Is it still open? Would like to work on it.

Yeah, although I think the work done by @infinite-spectrum can definitely be reused (with his credits, ofc), it was probably close to be "mergeable".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest idea
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants