{"id":20476835,"url":"https://github.com/oleiade/lhotse","last_synced_at":"2025-04-13T12:45:17.516Z","repository":{"id":62984319,"uuid":"560543762","full_name":"oleiade/lhotse","owner":"oleiade","description":"Tiny HTTP server with controllable performance.","archived":false,"fork":false,"pushed_at":"2024-01-14T21:31:49.000Z","size":158,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-12T21:53:52.078Z","etag":null,"topics":["go","golang","http","http-server","k6","load-testing","performance"],"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/oleiade.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":"2022-11-01T18:21:41.000Z","updated_at":"2023-03-21T21:57:02.000Z","dependencies_parsed_at":"2024-01-14T19:09:28.356Z","dependency_job_id":"1fd54096-dc1e-42c5-8c5f-c6a9a01f0617","html_url":"https://github.com/oleiade/lhotse","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oleiade%2Flhotse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oleiade%2Flhotse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oleiade%2Flhotse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oleiade%2Flhotse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oleiade","download_url":"https://codeload.github.com/oleiade/lhotse/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717241,"owners_count":21150387,"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":["go","golang","http","http-server","k6","load-testing","performance"],"created_at":"2024-11-15T15:23:33.926Z","updated_at":"2025-04-13T12:45:17.481Z","avatar_url":"https://github.com/oleiade.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp style=\"text-align: center\"\u003e\u003cimg src=\"logo.png\" alt=\"lhotse logo\"/\u003e\u003c/p\u003e\n\u003ch1 style=\"text-align: center\"\u003eLightweight HTTP server with controllable performance\u003c/h1\u003e\n\n\u003cp style=\"text-align: center\"\u003e\n    \u003ca href=\"https://github.com/oleiade/lhotse/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/release/oleiade/lhotse.svg\" alt=\"release\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/oleiade/lhotse/actions/workflows/build.yml\"\u003e\u003cimg src=\"https://github.com/oleiade/lhotse/actions/workflows/build.yml/badge.svg\" alt=\"Build status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nLhotse is a lightweight HTTP server designed for controlled performance testing.\nIt facilitates dictating the server's behavior, such as introducing specific latencies or generating responses of varying sizes.\nDeveloped to complement [k6](https://github.com/grafana/k6), Lhotse is an excellent tool for measuring [k6](https://github.com/grafana/k6)'s  accuracy and assisting in its improvement and debugging.\n\n## Installation\n\nInstall Lhotse using Go:\n\n```bash\ngo install github.com/oleiade/lhotse@latest\n```\n\n## Usage \u0026 Examples\n\nLhotse provides functionalities such as latency simulation, data response control, and custom response generation.\n\nHere are some examples:\n\n### Latency Control\n\n#### Fixed Duration\n\nCommand:\n```bash\ntime curl -X GET -i http://localhost:3434/latency/500ms\n```\n\nOutput:\n```bash\nHTTP/1.1 200 OK\nAllow: GET, OPTIONS\nDate: Tue, 01 Nov 2022 18:15:37 GMT\nContent-Length: 12\nContent-Type: text/plain; charset=utf-8\n\nwaited 500ms\n```\n\n#### Latency Range\n\nCommand:\n```bash\ncurl -X GET -i http://localhost:3434/latency/500ms-1s\n```\n\nOutput:\n```bash\nHTTP/1.1 200 OK\nAllow: GET, OPTIONS\nDate: Tue, 01 Nov 2022 18:16:43 GMT\nContent-Length: 19\nContent-Type: text/plain; charset=utf-8\n\nwaited 610.839158ms\n```\n\n### Data Response Control\n\n#### Fixed Size\n\nCommand:\n```bash\ncurl -X GET -i http://localhost:3434/data/8b\n```\n\nOutput:\n```bash\nHTTP/1.1 200 OK\nAllow: GET, OPTIONS\nDate: Tue, 01 Nov 2022 18:14:12 GMT\nContent-Length: 8\nContent-Type: text/plain; charset=utf-8\n\nTMtTCoaN\n```\n\n#### Size Range\n\nCommand:\n```bash\ncurl -X GET -i http://localhost:3434/data/64b-128b\n```\n\nOutput:\n```bash\nHTTP/1.1 200 OK\nAllow: GET, OPTIONS\nDate: Tue, 01 Nov 2022 18:13:02 GMT\nContent-Length: 116\nContent-Type: text/plain; charset=utf-8\n\nwhTHctcuAxhxKQFDaFpLSjFbcXoEFfRsWxPLDnJObCsNVlgTeMaPEZQleQYhYzRyJjPjzpfRFEgmotaFetHsbZRjxAwnwekrBEmfdzdcEkXBAkjQZLCt\n```\n\n### Custom Response Control\n\n#### Custom Status Code\n\nCommand:\n```bash\ncurl -X GET -i http://localhost:3434/response?status=204\n```\n\nOutput:\n```bash\nHTTP/1.1 204 No Content\nContent-Type: text/plain\nDate: Sun, 14 Jan 2024 10:17:35 GMT\n```\n\n#### Custom content-type\n\nCommand:\n```bash\ncurl -i -X GET --header 'Content-Type: application/json' http://localhost:3434/response\n```\n\nOutput:\n```bash\nHTTP/1.1 200 OK\nContent-Type: application/json\nDate: Sun, 14 Jan 2024 10:18:36 GMT\nContent-Length: 49\n\n{\"content_type\":\"application/json\",\"status\":200}\n```\n\n## API Reference\n\n#### Latency Control\n\nEndpoint `/latency/{duration}` simulates a response delay.\n\n```http\n  GET /latency/${duration}\n```\n\n| Parameter  | Type     | Description                                                                                   |\n|:-----------|:---------|:----------------------------------------------------------------------------------------------|\n| `duration` | `string` | Specifies the delay before responding. Use {value}{unit} or {lowerBound}-{upperBound} format. |\n\n#### Data Volume Control\n\nEndpoint `/data/{size}` controls the response size.\n\n```http\n  GET /data/${size}\n```\n\n| Parameter | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                       |\n|:----------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `size`    | `string` | Size of the payload produced by Lhotse. It can either be specified as a single size of the form {value}{unit}, or as a range {lowerBound}-{upperBound}. The value should always be an unsigned integer value. Valid units are `b`, `kb`, `mb`, and `gb`. When specifying a range, `lowerBound` needs to be less than `upperBound`, and as a result, the produced payload will be of a random size somewhere between those bounds. |\n\n#### Custom Response Control\n\nEndpoint `/response` allows customization of the response.\n\n```http\n  GET /response?status=${status}\n```\n\n##### Query Parameters\n\n| Parameter | Type     | Description                                      |\n|:----------|:---------|:-------------------------------------------------|\n| `status`  | `string` | Specifies the HTTP status code for the response. |\n\n##### Headers\n\n| Header         | Type     | Description                                                                                                 |\n|:---------------|:---------|:------------------------------------------------------------------------------------------------------------|\n| `Content-Type` | `string` | Determines the `Content-Type` of the response. Currently `text/plain` and `application/json` are supported. |\n\n## Contributing\nContributions to Lhotse are welcome! Whether it's bug reports, feature requests, or code contributions, please feel free to contribute. For more details, see CONTRIBUTING.md.\n\n## License\nLhotse is open-sourced under the MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foleiade%2Flhotse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foleiade%2Flhotse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foleiade%2Flhotse/lists"}