pub struct CollectedResponse {
pub status: StatusCode,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
}Expand description
A response fully read into memory — status, headers, body — rather
than the streaming hyper::Response<BoxBody> every dispatch function
returns.
§Why this exists (RFC 055)
apimock get answers a question; it does not write to a socket.
Reusing rule_set_response/dyn_route_content/respond_response
unchanged (the RFC’s own “one implementation of matching” principle)
still leaves a BoxBody on the way out, and a CLI command has
nothing to stream it to — it needs the bytes, once, to print or
serialise. This is the minimal additive surface that gap needed:
no new dispatch logic, just a collector for what dispatch already
produces.
Fields§
§status: StatusCode§headers: Vec<(String, String)>Header order preserved as received; values that aren’t valid
UTF-8 are dropped, matching how RequestSummary’s own header
collection (trace.rs) already treats non-UTF-8 values.
body: Vec<u8>