{"id":17794228,"url":"https://github.com/pyk/rust-http-clients","last_synced_at":"2025-04-02T02:21:30.270Z","repository":{"id":71958191,"uuid":"244201338","full_name":"pyk/rust-http-clients","owner":"pyk","description":"A Beginner Guide to Rust HTTP Client Libraries","archived":false,"fork":false,"pushed_at":"2020-03-01T18:27:45.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T17:22:56.997Z","etag":null,"topics":["http","http-client","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-03-01T18:24:46.000Z","updated_at":"2020-03-01T18:28:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"41215292-a693-42b0-b728-74836eba6aff","html_url":"https://github.com/pyk/rust-http-clients","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/pyk%2Frust-http-clients","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyk%2Frust-http-clients/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyk%2Frust-http-clients/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyk%2Frust-http-clients/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyk","download_url":"https://codeload.github.com/pyk/rust-http-clients/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246741314,"owners_count":20826104,"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","http-client","rust"],"created_at":"2024-10-27T11:15:35.628Z","updated_at":"2025-04-02T02:21:30.252Z","avatar_url":"https://github.com/pyk.png","language":"Rust","readme":"# A Beginner Guide to Rust HTTP Client Libraries\n\nThis repository contains an example of how to use HTTP client libraries in Rust.\n\nWe will start with low level library called `Hyper` and move up with high-level\nlibrary called `reqwest`.\n\nSo, let's start with `GET` request.\n\n# GET Request\n\nBelow is an example code on how to perform HTTP `GET` request using the\n`hyper` library\n\n```rust\nextern crate hyper;\n\nuse hyper::body::HttpBody as _;\nuse hyper::Client;\nuse tokio::io::{stdout, AsyncWriteExt as _};\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error + Send + Sync\u003e\u003e {\n    // This is where we will setup our HTTP client requests.\n    println!(\"Hello?\");\n\n    // Still inside `async fn main`...\n    let client = Client::new();\n\n    // Parse an `http::Uri`...\n    let uri = \"http://httpbin.org/ip\".parse()?;\n\n    // Await the response...\n    let mut resp = client.get(uri).await?;\n\n    println!(\"Response: {}\", resp.status());\n\n    // And now...\n    while let Some(chunk) = resp.body_mut().data().await {\n        stdout().write_all(\u0026chunk?).await?;\n    }\n\n    Ok(())\n}\n```\n\nMaybe you are beginner like me and have the following questions:\n\n1. What is `#[tokio::main]` ? Why is there?\n2. Why returns `Result\u003c(), Box\u003cdyn std::error::Error + Send + Sync\u003e\u003e` ?\n\nSee you next time.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyk%2Frust-http-clients","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyk%2Frust-http-clients","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyk%2Frust-http-clients/lists"}