Mock – an API Creation and Testing Utility: Examples
Posted2 months agoActiveabout 2 months ago
dhuan.github.ioTechstory
supportivepositive
Debate
20/100
API TestingMock APISoftware Development Tools
Key topics
API Testing
Mock API
Software Development Tools
The post introduces Mock, an API creation and testing utility, and sparks a discussion about its features, comparisons to similar tools, and potential use cases.
Snapshot generated from the HN discussion
Discussion Activity
Active discussionFirst comment
31m
Peak period
17
0-6h
Avg / period
6.3
Comment distribution19 data points
Loading chart...
Based on 19 loaded comments
Key moments
- 01Story posted
Nov 2, 2025 at 6:30 AM EST
2 months ago
Step 01 - 02First comment
Nov 2, 2025 at 7:02 AM EST
31m after posting
Step 02 - 03Peak activity
17 comments in 0-6h
Hottest window of the conversation
Step 03 - 04Latest activity
Nov 5, 2025 at 10:39 AM EST
about 2 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45789556Type: storyLast synced: 11/20/2025, 6:30:43 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
(I'm not saying it's on par with linux, I'm just saying it's usable)
> 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.
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.
Some products have these fancy KQL style search parameters but if you forget to 'save the search' within the applications 'Save Search' facility, then when you duplicate a tab the search is lost.
It feels rude when sites ignore the UX improvement by not leveraging the power of URLs to store current state.
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.
Any feedback is welcome!
- https://github.com/cablehead/http-nu or for POSIX - https://github.com/cablehead/http-sh
Ah, it's the "billable hours" variable.