friendsofgo / killgrave

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

Reuse path variable for bodyfile #176

Open eloo-abi opened 3 months ago

eloo-abi commented 3 months ago

Hi, this PR enables the usage of the variables defined in the imposters to be reused in the bodyFile path. So we can use "dynamic" responses for different paths easily. Fixes: #175

joanlopez commented 3 months ago

Hey @eloo-abi! Thanks for your contribution 💟 However, before moving forward, I'd like to see some tests that show the expected behavior in different scenarios (e.g. no variables at all, a variable with a single value, a variable with multiple values, multiple variables, when a non-defined variable is used, etc).

eloo-abi commented 3 months ago

Hi,

no variables at all

this is covered by the existing tests already as the implementation is not going to change anything here

a variable with a single value

will be added

a variable with multiple values

not sure what this is, can you give an example of a variable with multiple values?

multiple variables

will be added

when a non-defined variable is used

it behaves like a wrong manually entered path as the implementation is not doing anything special, just adjust the path to search for a file

joanlopez commented 3 months ago

Hi,

no variables at all

this is covered by the existing tests already as the implementation is not going to change anything here

a variable with a single value

will be added

a variable with multiple values

not sure what this is, can you give an example of a variable with multiple values?

multiple variables

will be added

when a non-defined variable is used

it behaves like a wrong manually entered path as the implementation is not doing anything special, just adjust the path to search for a file

Yes, please, ignore the case of multiple values for a single variable (I left a comment in the issue). Cover the rest, and we can go! 🚀

eloo-abi commented 3 months ago

tests added

i was not sure where or how to add to i have added it similar to other handler_tests i hope this makes sense

eloo-abi commented 2 months ago

@joanlopez hi, any news near? if everything fits your needs maybe we can merge this?

thanks

joanlopez commented 2 months ago

@joanlopez hi, any news near? if everything fits your needs maybe we can merge this?

thanks

Hey @eloo-abi! Sorry for the delay, I've been quite busy during recent weeks. I left some comments and suggestions, I think that, once fixed, it will be good enough to be merged, for me.

Thanks! 🙇🏻

eloo-abi commented 2 months ago

@joanlopez everything should be addressed :)

eloo-abi commented 2 months ago

@joanlopez did you have already time to have a look?

joanlopez commented 1 month ago

@joanlopez did you have already time to have a look?

Been AFK for some time during September, but planning to review it during October for sure! 🙇🏻

eloo-abi commented 3 weeks ago

@joanlopez if its not a blocker please merge this PR as it takes already a very long time for such a small change

joanlopez commented 3 weeks ago

@joanlopez if its not a blocker please merge this PR as it takes already a very long time for such a small change

Yeah, sure! I'm waiting for @aperezg to give his 👍🏻, which I hope we get in the next few days, it's alright from my side! 🙇🏻