{"id":16683048,"url":"https://github.com/hlts2/gomock","last_synced_at":"2025-07-28T02:08:04.331Z","repository":{"id":57547682,"uuid":"104212615","full_name":"hlts2/gomock","owner":"hlts2","description":"command line tool which makes simple API mock server.","archived":false,"fork":false,"pushed_at":"2018-11-19T16:50:54.000Z","size":6676,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-21T01:46:37.770Z","etag":null,"topics":["api-mock","api-mocker","api-server","api-testing","cli","cli-application","cli-tool","golang","gomock","hlts2","mock","mock-server","mocking","simple","testing-tools"],"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/hlts2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-20T12:29:08.000Z","updated_at":"2024-10-23T15:05:56.000Z","dependencies_parsed_at":"2022-09-26T16:31:11.020Z","dependency_job_id":null,"html_url":"https://github.com/hlts2/gomock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hlts2/gomock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlts2%2Fgomock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlts2%2Fgomock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlts2%2Fgomock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlts2%2Fgomock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hlts2","download_url":"https://codeload.github.com/hlts2/gomock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlts2%2Fgomock/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267451489,"owners_count":24089312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-mock","api-mocker","api-server","api-testing","cli","cli-application","cli-tool","golang","gomock","hlts2","mock","mock-server","mocking","simple","testing-tools"],"created_at":"2024-10-12T14:10:10.298Z","updated_at":"2025-07-28T02:08:04.309Z","avatar_url":"https://github.com/hlts2.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gomock [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Go Report Card](https://goreportcard.com/badge/github.com/hlts2/gomock)](https://goreportcard.com/report/github.com/hlts2/gomock) [![Join the chat at https://gitter.im/hlts2/gomock](https://badges.gitter.im/hlts2/gomock.svg)](https://gitter.im/hlts2/gomock?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\ngomock is command line tool which makes simple API mock server. No more waiting on backend teams to deliver services.\n\n## Install\n\n```shell\ngo get github.com/hlts2/gomock\n```\n\n## Example\n\n### Create a config file\n`config.yml` will help you get started mocking your API's.\n\n```yaml\nport: 1234\nendpoints:\n    - request:\n        path: /api/v1/todos/\n        method: GET //uppercase\n      response:\n        code: 200\n        body: todos.json\n        headers:\n            content-type: application/json\n```\n\n### Request path\nPaths can have variables. They are defined using the format {:id} or {:name}.\n\n```yaml\npath: /api/v1/users/*/          // match: /api/v1/users/little/, /api/v1/users/tiny/, etc\n\npath: /api/v1/users/*/name/     // match: /api/v1/users/g444/name/, /api/v1/users/f5444/name/, etc\n\npath: /api/v1/users/*/bools/*/  // match: /api/v1/users/111/books/f343/, /api/v1/users/4444/books/d343/, etc\n\npath: /api/v1/users?id=*        // match: /api/v1/users?id=1111, /api/v1/users?id=2222, etc\n```\n\n### Create JSON response file\n\n```json\n{\n  \"todos\": [\n    {\n      \"id\": 1,\n      \"title\": \"hoge\"\n    },\n    {\n      \"id\": 2,\n      \"title\": \"foo\"\n    }\n  ]\n}\n\n```\n\n### Start API mock server\n\n```\ngomock run -s config.yml\n```\n\n### Send request\n\n```\n$ curl -v localhost:1234/api/v1/todos/\n\n\u003e GET /api/v1/todos/ HTTP/1.1\n\u003e Host: localhost:1234\n\u003e User-Agent: curl/7.51.0\n\u003e Accept: */*\n\u003e\n\u003c HTTP/1.1 200 OK\n\u003c Content-Type: application/json\n\u003c Date: Wed, 20 Sep 2017 23:56:27 GMT\n\u003c Content-Length: 119\n\u003c\n{\n  \"todos\": [\n    {\n      \"id\": 1,\n      \"title\": \"hoge\"\n    },\n    {\n      \"id\": 2,\n      \"title\": \"foo\"\n    }\n  ]\n}\n\n```\n\n## Usage\n\n```\n$ gomock run --help\nNAME:\n   gomock run - start API mock server\n\nUSAGE:\n   gomock run [command options] [arguments...]\n\nOPTIONS:\n   --set value, -s value  config file (default: \"config.yml\")\n   --tls-path value       directory to the TLS server.crt/server.key file\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlts2%2Fgomock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhlts2%2Fgomock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlts2%2Fgomock/lists"}