[−][src]Struct seed::fetch::Request
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]
self
) -> impl Future<Item = A, Error = JsValue>
Use this to access the response's JSON: https://developer.mozilla.org/en-US/docs/Web/API/Body/json
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,