Struct wasmcloud_component::wasi::http::types::OutgoingResponse
source · 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.
headersis 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 transfered 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.