Skip to main content

Module http

Module http 

Source
Expand description

The HTTP seam.

Every request the GitHub and GitLab clients make goes through HttpTransport; nothing in this crate constructs a socket itself, so the whole crate is testable without a network. The clients’ tests drive RecordedTransport; only ReqwestTransport talks to a host.

Structs§

HttpBytes
A binary answer (HttpTransport::fetch_bytes): the status is left to the caller, because for a picture a 404 is an answer, not a failure.
HttpRequest
HttpResponse
RecordedTransport
A transport that answers from a table instead of from the network.
ReqwestTransport
The real transport. Built once per client, not per request: reqwest::Client owns the connection pool.

Enums§

Method

Constants§

BLOCK_EXTERNAL_ENV
Env var that makes the real transports refuse non-loopback hosts. Set by the PTY driver (xtask) for the TUI and the daemon it starts; always on in this crate’s own unit tests.
LIVE_TESTS_ENV
The master switch of live provider tests (gitpoulpi_testkit::live).

Traits§

HttpTransport

Functions§

external_host_refusal
Some(reason) when a test build must not send url: the host is not loopback, blocking is on (cfg(test) or BLOCK_EXTERNAL_ENV) and GITPOULPI_LIVE_TESTS=1 is not set. A leaked real call fails loudly instead of connecting. Production builds (neither set) never refuse.

Type Aliases§

Progress
A download’s progress callback: bytes received so far and the total when the host said it; false stops the download.