pub struct OutgoingResponse { /* private fields */ }
Expand description
Represents an outgoing HTTP Response.
Implementations§
Source§impl OutgoingResponse
impl OutgoingResponse
Sourcepub fn new(headers: Fields) -> OutgoingResponse
pub fn new(headers: Fields) -> OutgoingResponse
Construct an outgoing-response
, with a default status-code
of 200
.
If a different status-code
is needed, it must be set via the
set-status-code
method.
headers
is the HTTP Headers for the Response.
Source§impl OutgoingResponse
impl OutgoingResponse
Sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Get the HTTP Status Code for the Response.
Source§impl OutgoingResponse
impl OutgoingResponse
Sourcepub fn headers(&self) -> Fields
pub fn headers(&self) -> Fields
Get the headers associated with the Request.
The returned headers
resource is immutable: set
, append
, and
delete
operations will fail with header-error.immutable
.
This headers resource is a child: it must be dropped before the parent
outgoing-request
is dropped, or its ownership is transferred to
another component by e.g. outgoing-handler.handle
.
Source§impl OutgoingResponse
impl OutgoingResponse
Sourcepub fn body(&self) -> Result<OutgoingBody, ()>
pub fn body(&self) -> Result<OutgoingBody, ()>
Returns the resource corresponding to the outgoing Body for this Response.
Returns success on the first call: the outgoing-body
resource for
this outgoing-response
can be retrieved at most once. Subsequent
calls will return error.