spin_sdk::http

Struct IncomingResponse

Source
pub struct IncomingResponse { /* private fields */ }
Expand description

Represents an incoming HTTP Response.

Implementations§

Source§

impl IncomingResponse

Source

pub fn status(&self) -> StatusCode

Returns the status code from the incoming response.

Source§

impl IncomingResponse

Source

pub fn headers(&self) -> Headers

Returns the headers from the incoming response.

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 incoming-response is dropped.

Source§

impl IncomingResponse

Source

pub fn consume(&self) -> Result<IncomingBody, ()>

Returns the incoming body. May be called at most once. Returns error if called additional times.

Source§

impl IncomingResponse

Source

pub fn take_body_stream(&self) -> impl Stream<Item = Result<Vec<u8>, Error>>

Return a Stream from which the body of the specified response may be read.

§Panics

Panics if the body was already consumed.

Source

pub async fn into_body(self) -> Result<Vec<u8>, Error>

Return a Vec<u8> of the body or fails

§Panics

Panics if the body was already consumed.

Trait Implementations§

Source§

impl Debug for IncomingResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl TryFromIncomingResponse for IncomingResponse

Source§

type Error = Infallible

The error if conversion fails
Source§

fn try_from_incoming_response<'async_trait>( resp: IncomingResponse, ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,

Turn the IncomingResponse into the type
Source§

impl WasmResource for IncomingResponse

Source§

unsafe fn drop(_handle: u32)

Invokes the [resource-drop]... intrinsic.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.