Files
mytheclipse/crates/mytheclipse-http/README.md
T
asepharyana 8106f8943e feat: add 4 new crates (queue, tracing, http, cli) + enhancements to existing crates
New crates:
- mytheclipse-queue: unified job queue with WorkerPool, retry/backoff, DLQ
  Backends: in-memory (default), Redis, NATS, PostgreSQL
- mytheclipse-tracing: tracing subscriber layers with env filter + OTLP/Jaeger export
- mytheclipse-http: HTTP client/server with timeout + tracing, axum server
- mytheclipse-cli: CLI framework with clap derive, built-in subcommands

Enhancements to existing crates:
- mytheclipse-core: SemaphorePool, LeaderElection, HealthRegistry/HealthCheck
- mytheclipse-cache: AutoRefreshCache (bg refresh on miss), CacheMetrics
- mytheclipse-config: ConfigSchema for JSON Schema generation
- mytheclipse-storage: MultipartUploadDriver trait
- mytheclipse-crypto: PASETO v4.local token support

All features compile with --all-features; tests + clippy pass clean.
2026-08-29 16:05:02 +07:00

1.1 KiB

mytheclipse-http

HTTP client/server abstraction with built-in mytheclipse resilience primitives (retry, circuit breaker, timeout, rate limit).

Features

Feature Default Backend Description
client yes reqwest HTTP client with timeout + tracing.
server-axum no axum Axum-based server with health/metrics.
server-hyper no hyper Low-level hyper server.

Usage

[dependencies]
mytheclipse-http = "0.2"

Client with timeout

use mytheclipse_http::HttpClient;
use std::time::Duration;

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let client = HttpClient::new().with_timeout(Duration::from_secs(10));
    let resp = client.get("https://httpbin.org/get").await?;
    println!("status: {}", resp.status());
    Ok(())
}

Server (axum)

[dependencies]
mytheclipse-http = { version = "0.2", features = ["server-axum"] }
use mytheclipse_http::HttpServer;
use std::net::SocketAddr;

#[tokio::main]
async fn main() {
    let server = HttpServer::new("0.0.0.0:3000".parse().unwrap());
    server.run().await;
}