{"id":32847775,"url":"https://github.com/dhuan/mock","last_synced_at":"2026-03-10T16:04:28.063Z","repository":{"id":48160533,"uuid":"495196505","full_name":"dhuan/mock","owner":"dhuan","description":"Build and test APIs easily","archived":false,"fork":false,"pushed_at":"2025-12-06T11:35:02.000Z","size":1548,"stargazers_count":156,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-10T05:50:37.862Z","etag":null,"topics":["api","api-mocking","command-line-tool","e2e-tests","golang","mock","mock-server","server","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dhuan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-05-22T22:57:17.000Z","updated_at":"2025-12-06T11:35:05.000Z","dependencies_parsed_at":"2023-10-01T17:32:31.016Z","dependency_job_id":"dacb0280-8ecd-4620-9261-3a1c173b4c00","html_url":"https://github.com/dhuan/mock","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/dhuan/mock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhuan%2Fmock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhuan%2Fmock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhuan%2Fmock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhuan%2Fmock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dhuan","download_url":"https://codeload.github.com/dhuan/mock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhuan%2Fmock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30341710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-mocking","command-line-tool","e2e-tests","golang","mock","mock-server","server","testing"],"created_at":"2025-11-08T09:00:54.104Z","updated_at":"2026-03-10T16:04:28.054Z","avatar_url":"https://github.com/dhuan.png","language":"Go","readme":"# mock\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/dhuan/mock.svg)](https://pkg.go.dev/github.com/dhuan/mock)\n[![Go Report Card](https://goreportcard.com/badge/github.com/dhuan/mock)](https://goreportcard.com/report/github.com/dhuan/mock)\n\n*mock* is an API utility - it lets you:\n\n- define API routes easily through API configuration files or through\n  command-line parameters.\n- use shells scripts as response handlers. Or any other type of program can act\n  as response handlers.\n- test your API - make assertions on whether an endpoint was requested.\n\n[The fastest way to learn and understand `mock` is to see the examples page.](https://dhuan.github.io/mock/latest/examples.html)\n\n## Quick links\n\n- [User guide](https://dhuan.github.io/mock)\n- [User guide (main branch, not released yet)](https://dhuan.github.io/mock/latest)\n- [How-tos \u0026 Examples](https://dhuan.github.io/mock/latest/examples.html)\n\n## Getting started\n\nLet's look at a simple example - an API with 2 routes `GET say_hi/{name}` and\n`GET what_time_is_it`:\n\n```sh\n$ mock serve --port 3000 \\\n  --route 'say_hi/{name}' \\\n  --method GET \\\n  --response 'Hello, world! My name is ${name}.' \\\n  --route \"what_time_is_it\" \\\n  --method GET \\\n  --exec 'printf \"Now it is %s\" $(date +\"%H:%M\") | mock write'\n```\n\nNow try requesting your `mock API` at port 3000 (can also be from your\nbrowser!):\n\n```sh\n$ curl localhost:3000/say_hi/john_doe\n\nHello, world! My name is john_doe.\n\n$ curl localhost:3000/what_time_is_it\n\nNow it is 22:00\n```\n\n*mock* lets you also extend other APIs (or any HTTP service, for that matter.)\nSuppose you want to add a new route to an existing API running at\n``example.com``:\n\n```sh\n$ mock serve --port 3000 \\\n  --base example.com \\\n  --route 'some_new_route' \\\n  --method GET \\\n  --exec 'printf \"Hello, world!\" | mock write' \n```\n\nWith the ``--base example.com`` option above, your *mock API* will act as proxy\nto that other website, and extend it with an extra route `GET /some_new_route`.\nLook up \"Base APIs\" in the docs for more details.\n\n*[There are many other ways of further customising your APIs with *mock*. Read further through the guide to learn.](https://dhuan.github.io/mock)*\n\n## Installing\n\nmock is distributed as a single-file executable. Check the releases page and download the latest tarball.\n\n## License\n\n**mock** is licensed under MIT. For more information check the [LICENSE file.](LICENSE)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhuan%2Fmock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhuan%2Fmock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhuan%2Fmock/lists"}