I’ve found tools like Charles really useful for understanding what’s happening on the wire. When I need something more repeatable (tests, offline work), I usually reach for a mock server instead. I ended up building a small one for my own use and later open-sourced it:
Great article. In addition, updating your mocking code can often be time-consuming. To try to make this easier, I built mock[1], which streamlines the process of setting up mock services for testing.
It's also possible create an HTTP service that acts as a wrapper to yt-dlp with just a few lines of shell, I created this example in the following link:
Swagger is a tool for API design and documentation.
Mock on the other hand is an actual API creation utility with which you can define endpoints, execute some logic for each endpoint and then return some data to the client. There are other similar features which are covered in the user guide.
Mock is not:
- A tool for API Specs or documentation
- A GUI tool.
I admit explaining the usefulness of this tool is not the easiest thing.
That's true, it's not a very unique name. I started building it, but only months later I thought of making it public. And then never thought of renaming it.
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:
> 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.
Navigating through mediawiki to get pages edited all time requires a bunch of clicks. I wanted to be able to quickly edit wiki pages using any editor program instead of the browser.
https://dhuan.github.io/mock/latest/examples.html Command line utility that lets you build APIs with just one command.
https://github.com/dhuan/dop JSON/YAML manipulation with AWK style approach.