Expand description
The HTTP seam: one request/response shape, two backends.
§Why a trait rather than reqwest directly
Everything worth testing about this client sits above HTTP — whether both proxy headers went out, whether a mint happened inside the retry path, whether a reconnect resumed at the right byte. reqwest opens real sockets, so none of those are reachable from a test that does not stand up a server, and the two that matter most are only reachable by inspecting a request that was already sent.
So HttpBackend is the seam. Production is ReqwestBackend (in microvms-edges, and
at microvms_core::session::ReqwestBackend); a test supplies a
recorder that keeps every request head, or a backend that writes bytes at a
simulated network. The daemon made the mirror-image choice with
axum::serve::Listener, and for the same reason: the simulator stays out of the
shipping artifact.
§Streaming is a separate method
HttpBackend::send collects the whole body, which for an SSE attach means it
returns once the command is over — and every property worth checking about a stream
is only observable partway through. HttpBackend::open_stream hands back a chunk
source instead.
Structs§
- Http
Request - One request, already fully addressed: absolute URL, every header, whole body.
- Http
Response - One response, body already collected.
Traits§
- Chunk
Source - A body arriving in pieces.
- Http
Backend - The seam. Production and simulated transports implement this.
Type Aliases§
- Open
Stream - A streaming response: the head, and the body still to arrive.
- Shared
Backend - A backend behind an
Arc, which is what acrate::session::Sessionholds.