{"id":18356248,"url":"https://github.com/erengy/hypr","last_synced_at":"2025-06-20T22:39:20.377Z","repository":{"id":153402027,"uuid":"205243327","full_name":"erengy/hypr","owner":"erengy","description":"C++ HTTP client library based on libcurl","archived":false,"fork":false,"pushed_at":"2022-10-22T12:09:13.000Z","size":60,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T17:43:07.957Z","etag":null,"topics":["cpp17","header-only","http","work-in-progress"],"latest_commit_sha":null,"homepage":"","language":"C++","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/erengy.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},"funding":{"github":"erengy","patreon":"erengy"}},"created_at":"2019-08-29T20:14:39.000Z","updated_at":"2022-10-22T12:09:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"5fc8827f-4ff4-44b8-97fe-cc254e91290f","html_url":"https://github.com/erengy/hypr","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/erengy%2Fhypr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erengy%2Fhypr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erengy%2Fhypr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erengy%2Fhypr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erengy","download_url":"https://codeload.github.com/erengy/hypr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142592,"owners_count":21054665,"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":["cpp17","header-only","http","work-in-progress"],"created_at":"2024-11-05T22:09:22.753Z","updated_at":"2025-04-10T01:48:02.550Z","avatar_url":"https://github.com/erengy.png","language":"C++","funding_links":["https://github.com/sponsors/erengy","https://patreon.com/erengy"],"categories":[],"sub_categories":[],"readme":"# hypr\n\nhypr is an HTTP client library for C++. Provides an interface similar to [Requests](https://requests.readthedocs.io/). Uses [hypp](https://github.com/erengy/hypp/) and [libcurl](https://curl.haxx.se/) under the hood.\n\n## Usage\n\n***This is a work in progress. Usage in public applications is not yet recommended.***\n\n```cpp\n#include \u003ciostream\u003e\n#include \u003chypr.hpp\u003e\n\nint main() {\n  const auto r = hypr::get(\"https://example.com\");\n\n  std::cout \u003c\u003c r.status_code() \u003c\u003c '\\n';           // 200\n  std::cout \u003c\u003c r.header(\"content-type\") \u003c\u003c '\\n';  // text/html; charset=UTF-8\n  std::cout \u003c\u003c r.body().substr(0, 15) \u003c\u003c '\\n';    // \u003c!doctype html\u003e\n\n  return 0;\n}\n```\n\n### Advanced Usage\n\n```cpp\nconst auto r = hypr::request(\"POST\", \"https://httpbin.org/post\",\n    // Optional parameters can be given in any order\n    hypr::Query{{\"a\", \"1\"}, {\"b\", \"2\"}},\n    hypr::Headers{\n      {\"Content-Type\", \"text/plain\"},\n      {\"Referer\", \"https://github.com/erengy/hypr/\"},\n    },\n    hypr::Body{\"My body is ready.\"});\n\nstd::cout \u003c\u003c r.url() \u003c\u003c '\\n';  // https://httpbin.org/post?a=1\u0026b=2\n```\n\n```cpp\n// Requests can be built explicitly\nhypr::Request request;\nrequest.set_method(\"POST\");\nrequest.set_url(\"https://httpbin.org/post\");\nrequest.set_query({{\"a\", \"1\"}, {\"b\", \"2\"}});\nrequest.set_headers({\n    {\"Content-Type\", \"text/plain\"},\n    {\"Referer\", \"https://github.com/erengy/hypr/\"}});\nrequest.set_body(\"My body is ready.\");\n\n// Sessions can be reused\nhypr::Session session;\nconst auto r = session.send(request);\n```\n\n### Error Handling\n\n```cpp\n// FTP is not supported, so we will get an error\nconst auto r = hypr::get(\"ftp://example.com\");\n\nif (r.error()) {\n  std::cout \u003c\u003c \"Error: \" \u003c\u003c r.error().str() \u003c\u003c '\\n';  // Unsupported protocol\n  return r.error().code;  // CURLE_UNSUPPORTED_PROTOCOL\n}\n```\n\n## License\n\nLicensed under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferengy%2Fhypr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferengy%2Fhypr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferengy%2Fhypr/lists"}