1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! HTTP client abstraction for CDK
//!
//! This crate provides an HTTP client wrapper that abstracts the underlying HTTP library.
//! Using this crate allows other CDK crates to avoid direct dependencies on a specific backend.
//! Backend selection is feature-based: enable a native backend with `bitreq`
//! (default) or `reqwest`. The features are additive — when both are enabled,
//! `reqwest` takes precedence (see "Backend selection" below).
//! The default `bitreq` backend supports HTTP proxy URLs only. SOCKS proxy schemes
//! such as `socks5h` are supported only when this crate is built with the `reqwest`
//! feature.
//!
//! # Backend selection
//!
//! CDK library crates depend on HTTP capability, while this crate owns the concrete
//! backend choice. The `bitreq` backend is the default: any CDK crate that pulls in
//! HTTP support turns it on automatically. `cdk-common/http` enables `bitreq`, and
//! `cdk`'s `wallet` and `mint` features depend on it, so applications get a working
//! client out of the box — including with `cdk --no-default-features --features wallet`.
//!
//! The backend features are additive: enabling both `bitreq` and `reqwest`
//! resolves to `reqwest` (a strict superset that adds SOCKS proxy and
//! invalid-certificate support), so feature unification across a dependency graph
//! never conflicts. To use `reqwest`, add an explicit dependency on this crate with
//! the `reqwest` feature — it takes precedence wherever it is enabled:
//!
//! ```toml
//! [dependencies]
//! cdk = { version = "0.17.0", features = ["wallet"] }
//! cdk-http-client = { version = "0.17.0", features = ["reqwest"] }
//! ```
//!
//! When depending on this crate directly with `--no-default-features`, at least one
//! backend must be selected, or compilation fails with a clear error. To exercise the
//! `reqwest` backend in workspace checks:
//!
//! ```bash
//! cargo check -p cdk -p cdk-http-client --features cdk-http-client/reqwest
//! ```
//!
//! # Example
//!
//! ```no_run
//! 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
//! }
//! ```
pub use BitreqRequestBuilder;
pub use ReqwestRequestBuilder;
pub use WasmRequestBuilder;
pub use ;
pub use HttpError;
pub use RequestBuilder;
pub use ;
pub use Async;
pub use BitreqTransport;
pub use ReqwestTransport;
pub use TorAsync;
pub use Transport;