|
|
4 дней назад | |
|---|---|---|
| .. | ||
| src | 3 дней назад | |
| tests | 3 дней назад | |
| Cargo.toml | 3 дней назад | |
| README.md | 3 дней назад | |
HTTP client abstraction for the Cashu Development Kit (CDK).
This crate provides an HTTP client wrapper that abstracts the underlying HTTP library (reqwest), allowing other CDK crates to avoid direct dependencies on reqwest.
use cdk_http_client::{HttpClient, Response};
use serde::Deserialize;
#[derive(Deserialize)]
struct ApiResponse {
message: String,
}
async fn example() -> Response<ApiResponse> {
let client = HttpClient::new();
client.fetch("https://api.example.com/data").await
}
RequestBuilder):get(url) - GET request builderpost(url) - POST request builderpatch(url) - PATCH request builderfetch<R>(url) - simple GET returning JSONpost_json<B, R>(url, body) - POST with JSON bodypost_form<F, R>(url, form) - POST with form datapatch_json<B, R>(url, body) - PATCH with JSON body