BinaryIgor
14 hours ago
Interesting, a few questions: 1. How hard/easy is it to make responses dynamic, i.e. to use something from the request data like query/path param or a body to execute function instead of hardcoding the response 2. What's the main motivation for creating this tool? I feel like every programming language have similar tool already - WireMock for Java etc. Why should people switch?
dhuan_
14 hours ago
Hi thanks for the feedback checking out the project.
> What's the main motivation for creating this tool?
Similar tools exist out there for sure, but they are either complex (more than I wish they'd be) or somehow require you to use a specific programming languages. Mock lets you accomplish this without telling you which language you should use.
Also if you're using mock inside CI pipelines, it also helps the fact that you can just download a executable tool that does not require you the java platform or any other dependency.
> How hard/easy is it to make responses dynamic, i.e. to use something from the request data like query/path param or a body to execute function instead of hardcoding the response
With mock you can use shell scripts as "request handlers". With that said, capturing a query param or a JSON field from the request body is as simple as:
> $ USER_NAME=$(mock get-payload user.name)
> $ SOME_QUERY_STRING_PARAM=$(mock get-query foo)
You can see more of this topic here: https://dhuan.github.io/mock/shell_scripts.html
> I feel like every programming language have similar tool already - WireMock for Java etc. Why should people switch?
True. If people are happy with these tools and needing to use java (or any other lang the tool pulls you into), then there's not much reason to switch.