[][src]Struct seed::fetch::Request

pub struct Request<'a> { /* fields omitted */ }

Request is the entry point for all fetch requests. Its methods configure the request, and and handle the response. Many of them return the original struct, and are intended to be used chained together.

Methods

impl<'a> Request<'a>[src]

pub fn new(url: &'a str) -> Self[src]

pub fn method(self, val: Method) -> Self[src]

Set the HTTP method

pub fn header(self, name: &str, val: &str) -> Self[src]

Add a single header. String multiple calls to this together to add multiple ones. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers

pub fn body(self, val: &JsValue) -> Self[src]

pub fn body_json<A: Serialize>(self, val: &A) -> Self[src]

Serialize a Rust data structure as JSON; eg the payload in a POST request.

pub fn cache(self, val: RequestCache) -> Self[src]

pub fn credentials(self, val: RequestCredentials) -> Self[src]

https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials

pub fn integrity(self, val: &str) -> Self[src]

https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity

pub fn mode(self, val: RequestMode) -> Self[src]

https://developer.mozilla.org/en-US/docs/Web/API/Request/mode

pub fn redirect(self, val: RequestRedirect) -> Self[src]

https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections

pub fn referrer(self, val: &str) -> Self[src]

https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer

pub fn referrer_policy(self, val: ReferrerPolicy) -> Self[src]

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy

pub fn fetch(self) -> impl Future<Item = Response, Error = JsValue>[src]

Use this if you want access to the web_sys::Request, eg for status code.

pub fn fetch_string(self) -> impl Future<Item = String, Error = JsValue>[src]

https://developer.mozilla.org/en-US/docs/Web/API/Body/text

pub fn fetch_json<A: DeserializeOwned>(
    self
) -> impl Future<Item = A, Error = JsValue>
[src]

Use this to access the response's JSON: https://developer.mozilla.org/en-US/docs/Web/API/Body/json

Trait Implementations

impl<'a> Debug for Request<'a>[src]

Auto Trait Implementations

impl<'a> !Send for Request<'a>

impl<'a> !Sync for Request<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]