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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! HTTP client abstraction used by [`crate::collateral`].
//!
//! The `HttpClient` trait keeps `reqwest` (and its types / version) out
//! of this crate's public API surface. The default-path constructors
//! ([`with_default_http`](crate::collateral::CollateralClient::<crate::configs::DefaultConfig>::with_default_http),
//! [`from_env`](crate::collateral::CollateralClient::<crate::configs::DefaultConfig>::from_env))
//! still use `reqwest` internally, but no public function signature
//! mentions `reqwest::Client` — so a future `reqwest` major bump is an
//! internal change, not a breaking one for downstream callers.
//!
//! Callers that need a custom HTTP stack (different TLS config,
//! workspace-pinned `reqwest` major, non-`reqwest` transport, wasm host
//! fetch, …) implement [`HttpClient`] on their own type and pass it to
//! [`CollateralClient::new`](crate::collateral::CollateralClient::new).
//!
//! The trait is deliberately narrow — it covers only what
//! [`crate::collateral`] needs: a `GET`, plus access to status, named
//! headers, and the response body.
use BTreeMap;
use ;
use Vec;
use Result;
/// Owned HTTP response.
///
/// Bodies are buffered into memory: the PCCS endpoints used by this crate
/// return small payloads (≤ a few hundred KiB), so streaming is not worth
/// the abstraction cost.
/// HTTP transport used by [`CollateralClient`](crate::collateral::CollateralClient).
///
/// Implementations only need to support `GET`; the crate buffers
/// responses in memory (see [`HttpResponse`]).
///
/// The `async fn` here intentionally has no `Send` bound. Auto-traits
/// propagate through monomorphization, so callers using a `Send` impl
/// still get `Send` futures automatically; callers on single-threaded
/// runtimes don't pay the `Send` bound they don't need.
/// Opaque `reqwest`-backed [`HttpClient`] adapter.
///
/// The type name is `pub` only so it can sit as the default `H` on
/// [`CollateralClient`](crate::collateral::CollateralClient); the inner
/// `reqwest::Client` and the constructor are crate-private. Callers
/// obtain a value only indirectly via
/// [`with_default_http`](crate::collateral::CollateralClient::<crate::configs::DefaultConfig>::with_default_http)
/// /
/// [`from_env`](crate::collateral::CollateralClient::<crate::configs::DefaultConfig>::from_env)
/// and treat it as an opaque token — `reqwest::Client` does not appear
/// in any public signature, so a future `reqwest` major bump is an
/// internal change.
;