pub struct TransportResponse { /* private fields */ }Expand description
Production HTTP transport seam and its typed surfaces.
HttpTransport is the async injection point downstream clients
consume; TransportResponse is its success envelope (2xx status,
redacted headers, body); TransportError is its typed failure
surface, and TransportErrorClass is the label telemetry and retry
layers use to partition REST-transport failures without parsing error
messages. The native default implementation is ReqwestTransport;
the browser default lives in cow-sdk-core (transport::fetch).
Successful HTTP response captured by an HttpTransport implementation.
Carries the numeric status code, the response headers, and the response
body of a 2xx dispatch — the same field set
TransportError::HttpStatus already carries for non-2xx responses, so
one representation spans the success and failure channels. Accessor names
mirror http::Response (status, headers, into_body) so a later
migration onto http types is a mechanical rename rather than a
redesign. Fields stay private so the representation can evolve behind the
accessors.
Header values are wrapped in Redacted: response header sections can
carry Set-Cookie or gateway-injected credentials, so values never
render through Debug. The body is the payload the caller requested and
is exposed raw through TransportResponse::body; the std::fmt::Debug
implementation prints only its byte length.
Implementations construct a value only for 2xx responses; non-2xx
responses keep flowing through TransportError::HttpStatus. On browser
targets, cross-origin header visibility is bounded by CORS exposure:
Content-Type and the other safelisted names are always readable, while
anything else requires the server to opt in through
Access-Control-Expose-Headers.
Implementations§
Source§impl TransportResponse
impl TransportResponse
Sourcepub fn new(
status: u16,
headers: Vec<(String, Redacted<String>)>,
body: impl Into<String>,
) -> TransportResponse
pub fn new( status: u16, headers: Vec<(String, Redacted<String>)>, body: impl Into<String>, ) -> TransportResponse
Creates a response from its status code, headers, and body.
Sourcepub fn headers(&self) -> &[(String, Redacted<String>)]
pub fn headers(&self) -> &[(String, Redacted<String>)]
Returns the response headers as name/value pairs in wire order.
Trait Implementations§
Source§impl Clone for TransportResponse
impl Clone for TransportResponse
Source§fn clone(&self) -> TransportResponse
fn clone(&self) -> TransportResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransportResponse
impl Debug for TransportResponse
impl Eq for TransportResponse
Source§impl PartialEq for TransportResponse
impl PartialEq for TransportResponse
Source§fn eq(&self, other: &TransportResponse) -> bool
fn eq(&self, other: &TransportResponse) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TransportResponse
Auto Trait Implementations§
impl Freeze for TransportResponse
impl RefUnwindSafe for TransportResponse
impl Send for TransportResponse
impl Sync for TransportResponse
impl Unpin for TransportResponse
impl UnsafeUnpin for TransportResponse
impl UnwindSafe for TransportResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.