frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Mock – An API creation and testing utility: Examples

https://dhuan.github.io/mock/latest/examples.html
113•dhuan_•13h ago

Comments

ruguo•13h ago
Does it support Windows? I don’t see a Windows version on the GitHub releases page.
debuggingCode•12h ago
looks like based on linux is the reason
n0n0n4t0r•12h ago
With wsl (or docker desktop), for non production tooling, I don't think it's relevant anymore.

(I'm not saying it's on par with linux, I'm just saying it's usable)

dhuan_•11h ago
Hi! Not yet, unless you use it with containers.
a2800276•12h ago
Wonderful little tool! Something similar has been swirling aronud my head for a while. Thank you for sharing, it looks very useful.
dhuan_•11h ago
Hi, thanks for the feedback! I hope it's useful to you.
BinaryIgor•12h 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_•11h 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.

cozzyd•12h ago
the name mock has also been used for the RPM build environment tool (https://github.com/rpm-software-management/mock)
dhuan_•11h ago
Hi, thanks for the feedback!

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.

siva7•11h ago
> Making an existing API slow can be easily accomplished combining mock’s Base APIs and the delay option.

Ah, it's the "billable hours" variable.

calrain•11h ago
It frustrates me no end when large commercial web sites fail to store state in URLs. It should be updated when the user clicks the 'submit' button of a page, especially when related to searching.

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.

rirze•10h ago
Did you comment on the wrong post? There’s another post talking about storing state in URLs
dhuan_•10h ago
I think you intended to post here: https://news.ycombinator.com/item?id=45789474
calrain•1h ago
I did :) good pick up!
fhduksbegd•9h ago
How does this differ from swagger?
dhuan_•9h ago
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.

Any feedback is welcome!

hnBTsd•8h ago
What a great tool! Writing simple scriptable mock apis all for the command line. Very easy to include commands straight into documentation.

Open Source Malware

https://opensourcemalware.com/
1•salkahfi•1m ago•0 comments

Nanoparticle therapy restores brain function in mice with Alzheimer's

https://www.psypost.org/nanoparticle-therapy-restores-brain-function-in-mice-with-alzheimers-dise...
1•geox•1m ago•0 comments

How Well Does RL Scale?

https://www.tobyord.com/writing/how-well-does-rl-scale
1•gmays•2m ago•0 comments

Show HN: LogLayer v7 now with StatsD support

https://loglayer.dev/mixins/hot-shots.html
1•theogravity•4m ago•0 comments

Real Estate Data in Seconds

https://www.reventure.app/
1•salkahfi•4m ago•0 comments

Show HN: Share your AI chats to multiple channels

https://disperse.lovable.app/
1•a_code•6m ago•0 comments

Ask HN: Are all modern meta-search engines lame?

1•n1xis10t•7m ago•0 comments

AI Proof Businesses

https://worklifenotes.com/2025/11/02/ai-proof-businesses/
1•taleodor•8m ago•0 comments

Big Tech Is Spending More Than Ever on AI and It's Still Not Enough

https://www.wsj.com/tech/ai/big-tech-is-spending-more-than-ever-on-ai-and-its-still-not-enough-f2...
1•gmays•8m ago•0 comments

We built a cloud GPU notebook that boots in seconds

https://modal.com/blog/notebooks-internals
1•birdculture•12m ago•0 comments

The overengineered Solution to my Pigeon Problem

https://maxnagy.com/posts/pigeons/
1•cyb0rg0•14m ago•1 comments

Ask HN: Is Common Crawl used exhaustively by any search engine?

1•n1xis10t•14m ago•0 comments

First in the world: How Sound Transit built light rail on a floating bridge [video]

https://www.youtube.com/watch?v=-tImk5T3iiU
1•kaladin-jasnah•17m ago•0 comments

Monster Splash double-hires demo for Apple IIe

http://www.deater.net/weave/vmwprod/monstersplash/
1•deater•19m ago•0 comments

Does Emirates Operate Too Many Airbus A380s?

https://simpleflying.com/emirates-operate-too-many-airbus-a380s/
1•amichail•19m ago•0 comments

What Everyone Is Getting Wrong About AI and Jobs [video]

https://www.youtube.com/watch?v=IqwSb2hO1jE
1•mooreds•19m ago•0 comments

How to animate elements when navigating between pages – view transition API

https://garden.bradwoods.io/notes/javascript/web-api/view-transition
1•bradwoodsio•29m ago•0 comments

Applying Neuroscience and AI to Spiritual Growth

https://themagicchurch.org
2•gevnat•30m ago•2 comments

Viscerality

https://map.simonsarris.com/p/viscerality
1•simonsarris•34m ago•0 comments

Property Inspection App UK

https://www.oncircleai.com/inspect
1•bylde•34m ago•0 comments

CS and Math Resources

1•Shaneso•40m ago•0 comments

George R.R. Martin Wins First Battle in Game of Thrones Copyright Lawsuit

https://screenrant.com/george-rr-martin-game-of-thrones-book-copyright-infrightment-lawsuit-update/
1•latexr•40m ago•0 comments

Why workers are quitting the largest renewable energy park

https://www.theguardian.com/global-development/2025/sep/11/unpaid-wages-searing-heat-long-hours-w...
2•thelastgallon•44m ago•0 comments

Tech groups step up efforts to solve AI's big security flaw

https://www.ft.com/content/56cb100e-7146-488f-aae5-55304ae0eff6
2•salkahfi•47m ago•0 comments

A Simple Technique to Help You Fall Asleep

https://www.nytimes.com/2025/03/20/well/mind/sleep-cognitive-shuffling.html
2•thelastgallon•48m ago•0 comments

Under pressure from the ADL and Israel, Jimmy Wales directly edits Gaza entry

2•cramsession•49m ago•1 comments

AI Chip History Not Only Rhymes but Also Repeat Itself

https://diblante.com/user/magnetseven/post/ai-chip-history-not-only-rhymes-but-also-repeat-itself
1•magnetseven•51m ago•0 comments

A0.dev Building an App

https://a0.dev/
1•beezv•53m ago•1 comments

OpenAI is going Meta route, as it considers memory-based ads on ChatGPT

https://www.bleepingcomputer.com/news/artificial-intelligence/openai-is-going-meta-route-as-it-co...
4•OptionOfT•58m ago•2 comments

Show HN: I built a Raspberry Pi webcam to train my dog (using Claude)

https://github.com/harshibar/yogi-cam
2•hyerramreddy•58m ago•0 comments