Expand description
A throwaway HTTP/1.1 server on an ephemeral loopback port, shared by the tests of the forge crates and their consumers. This is a dev-only crate.
It answers canned responses and keeps every request it was sent, so a test
can assert on the bytes the client put on the wire. It is hand written
rather than taken from a crate such as wiremock: the whole server is one
accept loop, and a mock HTTP crate would add a second HTTP stack, and the
transitive versions that come with it, to a crate that deliberately vendors
a small dependency set and runs clippy::cargo.
The accept loop runs on a dedicated background runtime rather than the
callerβs own, so Server::start works the same from a #[test] and
from a #[tokio::test].
StructsΒ§
- Request
- One request as it arrived on the wire.
- Response
- One canned response.
- Server
- A server listening on
127.0.0.1with a port the kernel picked.
StaticsΒ§
- INSTALLING π
- Serializes callers of
install_tls_providerwithin this process.
FunctionsΒ§
- background_
runtime π - A background tokio runtime shared by every server in this test binary.
- find π
- install_
tls_ provider - Install the OpenSSL TLS provider for tests, keeping an existing provider.
- read_
more π - read_
request π - write_
response π