{"id":13645936,"url":"https://github.com/jcchavezs/httpmole","last_synced_at":"2025-06-15T11:03:07.685Z","repository":{"id":73797488,"uuid":"229729347","full_name":"jcchavezs/httpmole","owner":"jcchavezs","description":"A HTTP mole service","archived":false,"fork":false,"pushed_at":"2024-09-12T08:25:15.000Z","size":2801,"stargazers_count":132,"open_issues_count":7,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-01T20:06:18.707Z","etag":null,"topics":["http-server","mock-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcchavezs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-23T10:26:40.000Z","updated_at":"2024-07-21T06:03:36.000Z","dependencies_parsed_at":"2024-01-14T09:57:47.523Z","dependency_job_id":"b4e97e31-791f-46e7-8d99-371f7356e390","html_url":"https://github.com/jcchavezs/httpmole","commit_stats":{"total_commits":46,"total_committers":2,"mean_commits":23.0,"dds":"0.28260869565217395","last_synced_commit":"fe12ff1ec1e54bfe0e273d419117ad75d3716f6f"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcchavezs%2Fhttpmole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcchavezs%2Fhttpmole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcchavezs%2Fhttpmole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcchavezs%2Fhttpmole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcchavezs","download_url":"https://codeload.github.com/jcchavezs/httpmole/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252849158,"owners_count":21813783,"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":["http-server","mock-server"],"created_at":"2024-08-02T01:02:45.397Z","updated_at":"2025-05-07T09:25:09.483Z","avatar_url":"https://github.com/jcchavezs.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# httpmole\n\n[![CI](https://github.com/jcchavezs/httpmole/actions/workflows/ci.yaml/badge.svg)](https://github.com/jcchavezs/httpmole/actions/workflows/ci.yaml)\n\n**httpmole** provides a HTTP mock server that will act as a mole among your services, telling you everything http clients send to it and responding them whatever you want it to respond. Just like an actual mole.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"640\" height=\"356\" src=\"images/screencast.gif\"\u003e\n\u003c/p\u003e\n\n**Features:**\n\n- Use `response-status` and `response-header` to quickly spin up a http server.\n- Use `response-file` to **modify the response in real time** using a text editor.\n- Use `response-from` to act as a proxy and be able to inspect the request/response going to a given service.\n- Cascade several calls using `/proxy` reserved endpoint.\n\n## Install\n\n```bash\ngo install github.com/jcchavezs/httpmole/cmd/httpmole@latest\n```\n\n## Usage\n\n### Using the binary\n\n```bash\nhttpmole -p=8082 -response-status=200\n```\n\nor using a response file:\n\n```bash\nhttpmole -p=8082 -response-file=./myresponse.json\n```\n\n```json\n// myresponse.json\n{\n    \"status_code\": 200,\n    \"headers\": {\n        \"content-type\": \"application/json\"\n    },\n    \"body\": {\n        \"message\": \"I am real\"\n    }\n}\n```\n\nor proxying a service to inspect the incoming requests:\n\n```bash\nhttpmole -p=8082 -response-from=therealservice:8082\n```\n\nor proxying a cascaring call to different services to simulate a distributed transaction:\n\n```bash\n# terminal 1\nhttpmole -p=8081 -response-status=201\n\n# terminal 2\nhttpmole -p=8082 -response-status=202\n\n# terminal 3\nhttpmole -p=8083 -response-status=203\n```\n\nand running\n\n```bash\n$ curl -i http://localhost:8081/proxy/localhost:8082/proxy/localhost:8083\n\nHTTP/1.1 203 Non-Authoritative Information\nContent-Length: 0\nDate: Wed, 17 Jul 2024 08:51:00 GMT\nServer-Timing: app;dur=0.00\n```\n\n### Using docker\n\n```bash\ndocker run -p \"10080:10080\" ghcr.io/jcchavezs/httpmole -response-status=201\n```\n\nor pass a response file over volumes\n\n```bash\ndocker run -p \"10080:10080\" -v `pwd`/response.json:/httpmole/response.json ghcr.io/jcchavezs/httpmole -response-file=/httpmole/response.json\n```\n\n**httpmole** is heavily inspired by [httplab](https://github.com/gchaincl/httplab)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcchavezs%2Fhttpmole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcchavezs%2Fhttpmole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcchavezs%2Fhttpmole/lists"}