livery_test_adapter (livery v0.2.0)
View SourceIn-memory adapter used by tests and the parity suite.
Implements livery_adapter against an ETS-backed capture store
instead of a real socket. Callers can build a synthetic request,
run a middleware stack and handler against it, and inspect the
emitted status, headers, body chunks, and trailers without
touching a wire.
Response emission is delegated to livery:emit/3, the shared
walker that every adapter calls back into.
Summary
Functions
Push a body chunk (or terminal marker) into the per-request
process mailbox in the livery_body protocol.
Drive a request through a middleware stack and handler.
Types
Functions
-spec capabilities(listener()) -> livery_adapter:capabilities().
-spec feed_body(reference(), pid(), {data, iodata()} | {trailers, [{binary(), binary()}]} | eof | {reset, term()}) -> ok.
Push a body chunk (or terminal marker) into the per-request
process mailbox in the livery_body protocol.
-spec peer_info(stream()) -> livery_adapter:peer_info().
-spec run(livery_middleware:stack(), livery_middleware:handler(), map()) -> capture().
Drive a request through a middleware stack and handler.
Spec is a map of #livery_req{} fields. Returns the captured
response. Listener lifecycle is managed for the caller.
-spec run(livery_middleware:stack(), livery_middleware:handler(), map(), map()) -> capture().
-spec send_data(stream(), iodata(), livery_adapter:send_opts()) -> ok.
-spec send_headers(stream(), 100..599, [{binary(), binary()}], livery_adapter:send_opts()) -> ok.
-spec start() -> listener().
-spec status(capture()) -> undefined | 100..599.
-spec stop(listener()) -> ok.