Struct wasi::http::types::OutgoingRequest

source ·
pub struct OutgoingRequest { /* private fields */ }
Expand description

Represents an outgoing HTTP Request.

Implementations§

source§

impl OutgoingRequest

source

pub fn new(headers: Headers) -> Self

Construct a new outgoing-request with a default method of GET, and none values for path-with-query, scheme, and authority.

  • headers is the HTTP Headers for the Request.

It is possible to construct, or manipulate with the accessor functions below, an outgoing-request with an invalid combination of scheme and authority, or headers which are not permitted to be sent. It is the obligation of the outgoing-handler.handle implementation to reject invalid constructions of outgoing-request.

source§

impl OutgoingRequest

source

pub fn body(&self) -> Result<OutgoingBody, ()>

Returns the resource corresponding to the outgoing Body for this Request.

Returns success on the first call: the outgoing-body resource for this outgoing-request can be retrieved at most once. Subsequent calls will return error.

source§

impl OutgoingRequest

source

pub fn method(&self) -> Method

Get the Method for the Request.

source§

impl OutgoingRequest

source

pub fn set_method(&self, method: &Method) -> Result<(), ()>

Set the Method for the Request. Fails if the string present in a method.other argument is not a syntactically valid method.

source§

impl OutgoingRequest

source

pub fn path_with_query(&self) -> Option<String>

Get the combination of the HTTP Path and Query for the Request. When none, this represents an empty Path and empty Query.

source§

impl OutgoingRequest

source

pub fn set_path_with_query( &self, path_with_query: Option<&str> ) -> Result<(), ()>

Set the combination of the HTTP Path and Query for the Request. When none, this represents an empty Path and empty Query. Fails is the string given is not a syntactically valid path and query uri component.

source§

impl OutgoingRequest

source

pub fn scheme(&self) -> Option<Scheme>

Get the HTTP Related Scheme for the Request. When none, the implementation may choose an appropriate default scheme.

source§

impl OutgoingRequest

source

pub fn set_scheme(&self, scheme: Option<&Scheme>) -> Result<(), ()>

Set the HTTP Related Scheme for the Request. When none, the implementation may choose an appropriate default scheme. Fails if the string given is not a syntactically valid uri scheme.

source§

impl OutgoingRequest

source

pub fn authority(&self) -> Option<String>

Get the HTTP Authority for the Request. A value of none may be used with Related Schemes which do not require an Authority. The HTTP and HTTPS schemes always require an authority.

source§

impl OutgoingRequest

source

pub fn set_authority(&self, authority: Option<&str>) -> Result<(), ()>

Set the HTTP Authority for the Request. A value of none may be used with Related Schemes which do not require an Authority. The HTTP and HTTPS schemes always require an authority. Fails if the string given is not a syntactically valid uri authority.

source§

impl OutgoingRequest

source

pub fn headers(&self) -> Headers

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.

Trait Implementations§

source§

impl Debug for OutgoingRequest

source§

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

Formats the value using the given formatter. Read more

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>,

§

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>,

§

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.