{"id":51898673,"url":"https://github.com/greenstorm5417/barehttp","last_synced_at":"2026-07-26T13:01:17.446Z","repository":{"id":333974972,"uuid":"1139428359","full_name":"Greenstorm5417/barehttp","owner":"Greenstorm5417","description":"a minimal http client written for rust that is no_std","archived":false,"fork":false,"pushed_at":"2026-02-11T14:43:28.000Z","size":303,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-26T07:13:19.107Z","etag":null,"topics":["http-client","httpclient","minimal","no-std-alloc","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/barehttp/","language":"Rust","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/Greenstorm5417.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-22T00:16:45.000Z","updated_at":"2026-02-11T14:43:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Greenstorm5417/barehttp","commit_stats":null,"previous_names":["greenstorm5417/barehttp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Greenstorm5417/barehttp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Greenstorm5417%2Fbarehttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Greenstorm5417%2Fbarehttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Greenstorm5417%2Fbarehttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Greenstorm5417%2Fbarehttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Greenstorm5417","download_url":"https://codeload.github.com/Greenstorm5417/barehttp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Greenstorm5417%2Fbarehttp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35914262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-26T02:00:06.503Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-client","httpclient","minimal","no-std-alloc","rust"],"created_at":"2026-07-26T13:01:15.912Z","updated_at":"2026-07-26T13:01:17.399Z","avatar_url":"https://github.com/Greenstorm5417.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# barehttp\n\n[![Crates.io](https://img.shields.io/crates/v/barehttp)](https://crates.io/crates/barehttp) [![Documentation](https://docs.rs/barehttp/badge.svg)](https://docs.rs/barehttp) [![License](https://img.shields.io/crates/l/barehttp)](https://github.com/Greenstorm5417/barehttp) [![Build Status](https://github.com/Greenstorm5417/barehttp/workflows/CI/badge.svg)](https://github.com/Greenstorm5417/barehttp/actions) [![Downloads](https://img.shields.io/crates/d/barehttp)](https://crates.io/crates/barehttp) [![GitHub stars](https://img.shields.io/github/stars/Greenstorm5417/barehttp)](https://github.com/Greenstorm5417/barehttp/stargazers) [![GitHub issues](https://img.shields.io/github/issues/Greenstorm5417/barehttp)](https://github.com/Greenstorm5417/barehttp/issues) [![Rust Version](https://img.shields.io/badge/rust-2024+-blue.svg)](https://www.rust-lang.org)\n\n**A minimal, explicit HTTP client for Rust**\n\nbarehttp is a low-level, blocking HTTP client designed for developers who want\n**predictable behavior, full control, and minimal dependencies**.\n\nIt supports `no_std` (with `alloc`), avoids global state, and exposes all network\nbehavior explicitly. There is no async runtime, no hidden connection pooling,\nand no built-in TLS—you bring your own via adapters.\n\n## Key Features\n\n- **Minimal and explicit**: No global state, no implicit behavior\n- **`no_std` compatible**: Core works with `alloc` only\n- **Blocking I/O**: Simple, predictable execution model\n- **Generic adapters**: Custom socket and DNS implementations\n- **Compile-time safety**: Typestate enforces correct body usage\n\n## Quick Start\n\n```no_run\nuse barehttp::response::ResponseExt;\n\nlet response = barehttp::get(\"http://httpbin.org/get\")?;\nlet body = response.text()?;\nprintln!(\"{}\", body);\n# Ok::\u003c(), barehttp::Error\u003e(())\n```\n\n## Using `HttpClient`\n\nFor repeated requests or more control, use [`HttpClient`]:\n\n```no_run\nuse barehttp::HttpClient;\nuse barehttp::response::ResponseExt;\n\nlet mut client = HttpClient::new()?;\n\nlet response = client\n    .get(\"http://httpbin.org/get\")\n    .header(\"User-Agent\", \"my-app/1.0\")\n    .call()?;\n\nprintln!(\"Status: {}\", response.status_code);\nprintln!(\"Body: {}\", response.text()?);\n# Ok::\u003c(), barehttp::Error\u003e(())\n```\n\n## Configuration\n\nClient behavior is controlled via [`config::Config`] and [`config::ConfigBuilder`]:\n\n```no_run\nuse barehttp::HttpClient;\nuse barehttp::config::ConfigBuilder;\nuse core::time::Duration;\n\nlet config = ConfigBuilder::new()\n    .timeout(Duration::from_secs(30))\n    .max_redirects(5)\n    .user_agent(\"my-app/2.0\")\n    .build();\n\nlet mut client = HttpClient::with_config(config)?;\n\nlet response = client.get(\"http://httpbin.org/get\").call()?;\n# Ok::\u003c(), barehttp::Error\u003e(())\n```\n\n## Making Requests\n\n### GET\n\n```no_run\nlet mut client = barehttp::HttpClient::new()?;\n\nlet response = client.get(\"http://httpbin.org/get\").call()?;\n# Ok::\u003c(), barehttp::Error\u003e(())\n```\n\n### POST with body\n\n```no_run\nlet mut client = barehttp::HttpClient::new()?;\n\nlet response = client\n    .post(\"http://httpbin.org/post\")\n    .header(\"Content-Type\", \"application/json\")\n    .send(br#\"{\"name\":\"test\"}\"#.to_vec())?;\n# Ok::\u003c(), barehttp::Error\u003e(())\n```\n\n## Type-Safe Request Bodies\n\nRequest methods enforce body semantics at compile time:\n\n- GET, HEAD, DELETE, OPTIONS → methods without body\n- POST, PUT, PATCH → methods with body\n\n```compile_fail\nlet mut client = barehttp::HttpClient::new()?;\nclient.get(\"http://example.com\").send(vec![])?;\n```\n\n```no_run\nlet mut client = barehttp::HttpClient::new()?;\nclient.post(\"http://example.com\").send(b\"data\".to_vec())?;\n# Ok::\u003c(), barehttp::Error\u003e(())\n```\n\n## Error Handling\n\nAll operations return `Result\u003cT, barehttp::Error\u003e`.\n\nErrors include:\n- DNS resolution failures\n- Socket I/O errors\n- Parse errors\n- HTTP status errors (4xx/5xx by default)\n\n```no_run\nuse barehttp::{Error, HttpClient};\n\nlet mut client = HttpClient::new()?;\n\nmatch client.get(\"http://httpbin.org/status/404\").call() {\n    Ok(resp) =\u003e println!(\"Status: {}\", resp.status_code),\n    Err(Error::HttpStatus(code)) =\u003e println!(\"HTTP error: {}\", code),\n    Err(e) =\u003e println!(\"Other error: {:?}\", e),\n}\n# Ok::\u003c(), barehttp::Error\u003e(())\n```\n\nAutomatic HTTP status errors can be disabled via configuration.\n\n## Response Helpers\n\nThe [`response::ResponseExt`] trait provides helpers for common tasks:\n\n```no_run\nuse barehttp::response::ResponseExt;\n\nlet mut client = barehttp::HttpClient::new()?;\nlet response = client.get(\"http://httpbin.org/get\").call()?;\n\nif response.is_success() {\n    let text = response.text()?;\n    println!(\"{}\", text);\n}\n# Ok::\u003c(), barehttp::Error\u003e(())\n```\n\n## Custom Socket and DNS Adapters\n\nbarehttp’s networking is fully pluggable.\n\nImplement `BlockingSocket` and `DnsResolver` traits to provide:\n\n- TLS via external libraries\n- Proxies or tunnels\n- Embedded or WASM networking\n- Test mocks\n\n```no_run\nuse barehttp::{HttpClient, OsBlockingSocket, OsDnsResolver};\n\nlet dns = OsDnsResolver::new();\nlet mut client: HttpClient\u003cOsBlockingSocket, _\u003e = HttpClient::new_with_adapters(dns);\nlet response = client.get(\"http://example.com\").call()?;\n# Ok::\u003c(), barehttp::Error\u003e(())\n```\n\n## Design Notes\n\n- Blocking I/O keeps the API simple and dependency-free\n- Each request is independent and explicit\n- No shared state or background behavior\n\nbarehttp is intended for environments where **clarity and control matter more than convenience**.\n\n## License\n\nLicensed under either of:\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenstorm5417%2Fbarehttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreenstorm5417%2Fbarehttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenstorm5417%2Fbarehttp/lists"}