{"id":18001547,"url":"https://github.com/hehonghui/mockserver","last_synced_at":"2025-03-26T08:30:49.915Z","repository":{"id":146185610,"uuid":"115497467","full_name":"hehonghui/MockServer","owner":"hehonghui","description":"mock server with Go","archived":false,"fork":false,"pushed_at":"2017-12-27T08:05:38.000Z","size":11,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T11:50:34.118Z","etag":null,"topics":["mock","mockserver","mockserverresponse","mockservice"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hehonghui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-12-27T08:05:16.000Z","updated_at":"2023-08-29T10:58:28.000Z","dependencies_parsed_at":"2023-05-26T00:45:26.154Z","dependency_job_id":null,"html_url":"https://github.com/hehonghui/MockServer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2FMockServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2FMockServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2FMockServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2FMockServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hehonghui","download_url":"https://codeload.github.com/hehonghui/MockServer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245618569,"owners_count":20645024,"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","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":["mock","mockserver","mockserverresponse","mockservice"],"created_at":"2024-10-29T23:17:55.439Z","updated_at":"2025-03-26T08:30:49.890Z","avatar_url":"https://github.com/hehonghui.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A simple mock server with Go\n\n用Go语言实现的一个简单的mock server (只支持完整的path匹配,不支持参数化), 在配置文件 mapping.json 文件中配置每个请求的path、对应的请求方式、保存Response数据的文件路径. \n\n示例如下:\n\n```json\n[\n  {\n    \"path\": \"/v4/users/\",\n    \"method\": \"GET\",\n    \"resp_file\": \"/Users/yourname/config/responses/users_resp.json\"\n  },\n  {\n    \"path\": \"/v5/categories/rec/articles/next/\",\n    \"method\": \"POST\",\n    \"resp_file\": \"/Users/yourname/config/responses/news_list_data.json\"\n  }\n]\n```\n\n## 启动mock server\n\n进入到项目所在的目录,执行启动命令\n\n```\ngo run mockserver.go ~/mapping.json\n```\n\n其中最后一个参数为 mapping.json 所在的路径, 修改为你的mapping路径即可.\n\n\n## 验证mock server 是否正常启动\n\n终端中输入如下Log 即表示成功解析mapping文件,并启动mock server.\n\n\n```\nMapping file is  /Users/yourname/mapping.json\n=================================================\u003e init router START\nroute :  path : /v4/users/, method : GET, file : /Users/yourname/config/responses/users_resp.json .\nroute :  path : /v5/categories/rec/articles/next/, method : GET, file : /Users/yourname/config/responses/news_list_data.json .\nroute :  path : /v9/categories/sorted/, method : GET, file : /Users/yourname/config/responses/channels.json .\n================================================\u003e init router END !\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhehonghui%2Fmockserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhehonghui%2Fmockserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhehonghui%2Fmockserver/lists"}