killgrave icon indicating copy to clipboard operation
killgrave copied to clipboard

Allow setting different responses per request (repeats)

Open joanlopez opened this issue 6 years ago • 9 comments

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.

joanlopez avatar Oct 14 '19 11:10 joanlopez

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 :)

spinales avatar Sep 30 '20 20:09 spinales

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

joanlopez avatar Oct 01 '20 06:10 joanlopez

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

spinales avatar Oct 03 '20 18:10 spinales

@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

spinales avatar Oct 07 '20 04:10 spinales

@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.

infinite-spectrum avatar Jun 19 '21 11:06 infinite-spectrum

@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.

joanlopez avatar Jun 19 '21 12:06 joanlopez

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

infinite-spectrum avatar Jun 22 '21 16:06 infinite-spectrum

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

vivekprm avatar Jul 26 '23 05:07 vivekprm

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".

joanlopez avatar Jul 26 '23 09:07 joanlopez