friendsofgo / killgrave

Simple way to generate mock servers written in Go
https://friendsofgo.github.io/killgrave/
MIT License
523 stars 100 forks source link

feature request: ability to define a sequence of responses #165

Closed kilianc closed 6 months ago

kilianc commented 7 months ago

It would be very nice to pass in an array of responses to use in the imposter to control the order and kind of payload in a e2e test suite.

joanlopez commented 7 months ago

Hey @kilianc,

Do you mean something like what's described in #31? See the discussion started there, and even the work another community folk started.

Perhaps a good opportunity for you to contribute? 😛 Or, at least, to help defining such feature 🙇🏻

kilianc commented 7 months ago

I looked at #68 and the code looks fine, is there a problem with that code change if proposed again? (other than a rebase)

joanlopez commented 7 months ago

I looked at #68 and the code looks fine, is there a problem with that code change if proposed again? (other than a rebase)

I think that code was not only missing a rebase but also had some tests failing, was arguably adding a breaking change, and the approach was probably a bit poor (you was only allowed to set different bodies, not different full responses).

What do you think about #167? Would that be enough for what you're looking for? Take a look at the TestImposterHandler_MultipleRequests test (both cases), please.

Thanks! 🙇🏻