{"id":20980513,"url":"https://github.com/hyperjumptech/httptarget","last_synced_at":"2025-05-14T15:30:41.400Z","repository":{"id":53779509,"uuid":"346067617","full_name":"hyperjumptech/httptarget","owner":"hyperjumptech","description":"HttpTarget is a very simple, small and lightweight HTTP server that would be helpful for http client development tool. Simply start the server and it'll be ready to accept incoming http requests. It can easily simulate heavy server side load by implementing random delay range, or simulate any kind of http response code.","archived":false,"fork":false,"pushed_at":"2021-03-14T18:41:28.000Z","size":691,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-02T20:05:04.908Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperjumptech.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":"2021-03-09T16:16:13.000Z","updated_at":"2024-01-06T00:43:11.000Z","dependencies_parsed_at":"2022-09-22T08:43:14.810Z","dependency_job_id":null,"html_url":"https://github.com/hyperjumptech/httptarget","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fhttptarget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fhttptarget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fhttptarget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fhttptarget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperjumptech","download_url":"https://codeload.github.com/hyperjumptech/httptarget/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254171548,"owners_count":22026462,"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":[],"created_at":"2024-11-19T05:28:58.335Z","updated_at":"2025-05-14T15:30:40.279Z","avatar_url":"https://github.com/hyperjumptech.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HttpTarget\n\n**HttpTarget** is a very simple, small and lightweight HTTP server that would be helpful for http client development tool.\nSimply start the server and it'll be ready to accept incoming http requests. It can easily simulate heavy server side load\nby implementing random delay range, or simulate any kind of http response code.  \n \nIt has the following features:\n\n1. Multiple URL path support, each of them is configurable for their response code, response time, response body and header.\n2. Add, modify, remove URL path in realtime without the need to restart the server.\n3. Simple API (equiped with OpenAPI 2.0 Swagger) for you app to integrate straight to the server for their testing purpose.\n\n## Get HttpTarget\n\nYou can obtain **HttpTarget** binary in 2 ways. By simply download the released binary for \nyour platform or you can always build the binary your self.\n\n### Download the HttpTarget binary\n\nYour can download **HttpTarget** binary from the [release page on Github](https://github.com/hyperjumptech/httptarget/releases).\nThere you download the binary for your platform:\n\n- Windows : httptarget-windows.tar.gz\n- Linux : httptarget-linux.tar.gz\n- MacOS : httptarget-macos.tar.gz\n\nYou can then extract the downloaded tarball (.tar.gz) for the executable. The executable will run straight-away without needing any dependency. \n\n### Build HttpTarget binary\n\nTo build the binary, you to install the following apps.\n\n- Git client\n- Golang 1.16 Compiler\n\nOnce done, assuming you know basic GIT, you can do the following steps.\n\n1. Clone the httptarget project from [github repository](https://github.com/hyperjumptech/httptarget).\n2. From the clone directory you can simply execute `make build-linux` to build linux binary, `make build-windows` to build windows binary or `make build-macos` to build mac os binary. Or simply build them all using `make build-all`\n3. Once done, a new directory `build` is created contains your compressed binary.\n4. Extract the compressed binary (tarball .tar.gz) to get your executable.\n\nIf you don't have `gnumake` application to run `make`, you can build the binary straight away using `go build -o . ./...`\n\n## Binary Usage\n\nNow you have the executable binary. To run the server you can simply run the executable\n\n```bash\n$ httptarget.app\nINFO[0000] Added test endpoint on [/], code 200, minDelay 0 ms, maxDelay 200 ms \nINFO[0000] Server listening at 0.0.0.0:51423 \n```\n\nBy default, the server will listen on port `51423`. To stop the server simply hit `ctrl+c`\n\nThere are few argument available when you start the server. The argument is usefull to \nconfigure the server for:\n\n- Listening on speciffic port\n- Bind to speciffic host IP (network interface)\n- The initial __endpoint__ to service, including its response code, body, header\n- The initial responseTime range (to simulate slow response due to load or network problem)\n\nTo see all possible argument, simply put `-help` argument.\n\n```bash\n$ httptarget.app -help\nUsage of httptarget:\n  -body string\n        HTTP response body (default \"OK\")\n  -code int\n        Response code (default 200)\n  -h string\n        Bind host (default \"0.0.0.0\")\n  -help\n        Display this help message\n  -maxDelay int\n        Maximum Delay Millisecond (default 200)\n  -minDelay int\n        Minimum Delay Millisecond\n  -p int\n        Listen port (default 51423)\n  -path string\n        Base path (default \"/\")\n```\n\n## API to Manage or to Integrate to the Server.\n\n**HttpTarget** is implementing OpenAPI standard. The OpenAPI Swagger documentation is immediately available\nas soon as you start the server.\n\n```bash\n$ ./httptarget.app \nINFO[0000] Added test endpoint on [/], code 200, minDelay 0 ms, maxDelay 200 ms \nINFO[0000] Server listening at 0.0.0.0:51423 \n```\n\nThere you notice that it's starting on the server that bind to any interface (0.0.0.0), on port `51423`. Thus you can open your\nfavourite web-browser and go to `http://localhost:51423/docs/index.html`. It will open the swagger API spec page where \nyou can configure your server or integrate your testing with. The __OpenAPI Swagger__ page will tell you everything about\n__API Endpoints__ available for you to use, what __method__, __parameters__, __URL__, etc.\n\n## Running HttpTarget from Docker\n\nFor Docker lover, good news ! Docker is the easiest way to run **HttpTarget**. Simply copy bellow command\nand paste it in your terminal... err, you might need `sudo`\n\n```bash\ndocker run --name myhttptarget -p 8080:51423 --detach hyperjump/httptarget:v1.1.0\n```\n\nYeah... you can immediately open port `8080` (as in `http://localhost:8080/docs`) after running that docker image. Or use another port as you wish.\nNo download, extract fuss. Just that.\n\n## All configuration stuff is too complicated, Let me test straight away !!\n\n**HttpTarget** configuration (swagger etc) is indeed not for every body ;). However, for you who don't want to sweat the configuration, \nyou can straight away uses the following 2 built-in endpoint groups. (oh yeah, they accept any `method`)\n\n**Delay Endpoints**\n\nThey have the following path patterns\n\n- `/delay/{delay}` This endpoint will simply delay it-self for __{delay}__ milliseconds and return http response code `200`\n- `/delay/{minDelay}/{maxDelay}` This endpoint will simply delay it-self for between __{minDelay}__ and __{maxDelay}__ milliseconds and return http response code `200`\n\nfor example :\n\n```text\n\u003e\u003e GET http://localhost:51423/delay/1000/2000\n\u003c\u003c 200 OK\n\u003c\u003c OK, delayed between 1000ms and 2000ms : 1120ms\n```\n\n```text\n\u003e\u003e GET http://localhost:51423/delay/1000\n\u003c\u003c 200 OK\n\u003c\u003c OK, delayed between 1000ms and 1000ms : 1000ms\n```\n\n**Code Endpoints**\n\nThey have the following path pattern\n\n- `/code/{responsecode}` This endpoint will simply http response code __{responsecode}__\n- `/code/{responsecode}/{delay}` This endpoint will simply delay it-self for __{delay}__ milliseconds and return http response code __{responsecode}__\n- `/code/{responsecode}/{minDelay}/{maxDelay}` This endpoint will simply delay it-self for between __{minDelay}__ and __{maxDelay}__ milliseconds and return http response code __{responsecode}__\n\nfor example :\n\n```text\n\u003e\u003e GET http://localhost:51423/code/202/2000\n\u003c\u003c 202 Accepted\n\u003c\u003c OK, delayed between 2000ms and 2000ms : 2000ms\n```\n\n```text\n\u003e\u003e GET http://localhost:51423/code/500/2000/3000\n\u003c\u003c 500 Internal Server Error\n\u003c\u003c OK, delayed between 2000ms and 3000ms : 2630ms\n```\n\n\nFinally, Happy Testing from Hyperjump team !!!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperjumptech%2Fhttptarget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperjumptech%2Fhttptarget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperjumptech%2Fhttptarget/lists"}