| Crates.io | waygate |
| lib.rs | waygate |
| version | 0.1.0 |
| created_at | 2025-12-03 07:33:45.916856+00 |
| updated_at | 2025-12-03 07:33:45.916856+00 |
| description | A modern HTTP client for Rust focusing on reliability, streaming, and extensibility. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1963513 |
| size | 41,307 |
waygate is a modern HTTP client for Rust. It focuses on predictable behaviour, a clean async API, and a design that can grow with services, CLIs, and libraries.
This repository currently contains an early 0.1.0 release of the library.
The 0.1.0 release is intentionally small and focused:
Streaming bodies and more advanced configuration options are planned but not yet implemented in this release.
Add the crate to your Cargo.toml:
[dependencies]
waygate = "0.1.0"
Then import it in your code:
use waygate::HyperClient;
The example below performs a simple GET request using the hyper-backed client.
use http::Uri;
use waygate::HyperClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = HyperClient::new();
let uri: Uri = "https://example.com".parse()?;
let response = client.get(uri).await?;
println!("Status: {}", response.status);
println!("Body: {}", String::from_utf8_lossy(&response.body));
Ok(())
}
For tests or local development, you can use the mock client:
use http::{Method, Uri};
use waygate::{MockClient, request::Request};
#[tokio::test]
async fn example_with_mock_client() {
let client = MockClient::new();
let uri: Uri = "http://example.test".parse().unwrap();
let request = Request::new(Method::GET, uri);
let response = client.send(request).await.unwrap();
assert_eq!(response.status.as_u16(), 501);
}
The client exposes a simple configuration structure that can be adjusted as needed:
use std::time::Duration;
use http::Uri;
use waygate::HyperClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = HyperClient::new();
client.config_mut().request_timeout = Some(Duration::from_secs(5));
let uri: Uri = "https://example.com".parse()?;
let _response = client.get(uri).await?;
Ok(())
}
As the library evolves, this configuration will grow to cover more advanced behaviour such as retry policies and redirect handling.
Planned areas of improvement include:
For a more detailed view of the direction and milestones, see plan.md in the repository root.
This project is distributed under the terms of the license found in the LICENSE file.