[][src]Trait fastly::request::RequestExt

pub trait RequestExt: Sized {
    fn inner_to_body(self) -> Result<Request<Body>, Error>;
fn inner_to_bytes(self) -> Result<Request<Vec<u8>>, Error>;
fn fastly_metadata(&self) -> &FastlyRequestMetadata;
fn fastly_metadata_mut(&mut self) -> &mut FastlyRequestMetadata; fn send(self, backend: &str) -> Result<Response<Body>, Error> { ... }
fn send_async(self, backend: &str) -> Result<PendingRequest, Error> { ... }
fn set_cache_override(&mut self, cache_override: CacheOverride) { ... }
fn get_cache_override(&self) -> CacheOverride { ... }
fn set_pass(&mut self) { ... }
fn set_ttl(&mut self, ttl: u32) { ... }
fn set_stale_while_revalidate(&mut self, swr: u32) { ... } }

Required methods

fn inner_to_body(self) -> Result<Request<Body>, Error>

Replace the body of a request with a Body with the same contents.

fn inner_to_bytes(self) -> Result<Request<Vec<u8>>, Error>

Replace the body of a request with the remaining contents of its body.

Note that this will involve copying and buffering the body, and so should only be used for convenience on small request bodies.

fn fastly_metadata(&self) -> &FastlyRequestMetadata

Get a reference to the Fastly-specific metadata associated with this request.

fn fastly_metadata_mut(&mut self) -> &mut FastlyRequestMetadata

Get a mutable reference to the Fastly-specific metadata associated with this request.

Loading content...

Provided methods

fn send(self, backend: &str) -> Result<Response<Body>, Error>

Send a request via the given backend, returning as soon as the headers are available.

fn send_async(self, backend: &str) -> Result<PendingRequest, Error>

Send a request asynchronously via the given backend, returning as soon as the request has begun sending.

The resulting PendingRequest can be evaluated using PendingRequest::poll(), PendingRequest::wait(), or select. It can also be discarded if the request was sent for effects it might have, and the response is unimportant.

fn set_cache_override(&mut self, cache_override: CacheOverride)

Set the cache override behavior for this request.

This will override the behavior defined by the backend response headers, as well as any previous override calls on this request (e.g., set_pass(), set_ttl()).

fn get_cache_override(&self) -> CacheOverride

Get the cache override behavior for this request.

fn set_pass(&mut self)

Set the cache override behavior for this request to Pass.

This will override the behavior defined by the backend response headers, as well as any previous calls on this request to set the TTL or stale-while-revalidate time.

fn set_ttl(&mut self, ttl: u32)

Set the cache override behavior for this request to use given TTL.

This option can be combined with a stale-while-revalidate override.

This will override the behavior defined by the backend response headers, as well as any previous calls on this request to set Pass.

fn set_stale_while_revalidate(&mut self, swr: u32)

Set the cache override behavior for this request to use given stale-while-revalidate time.

This option can be combined with a TTL override.

This will override the behavior defined by the backend response headers, as well as any previous calls on this request to set Pass.

Loading content...

Implementors

impl RequestExt for Request<()>[src]

impl RequestExt for Request<Body>[src]

Fastly-specific extensions to http::Request.

impl RequestExt for Request<String>[src]

impl RequestExt for Request<Vec<u8>>[src]

impl<'_> RequestExt for Request<&'_ str>[src]

impl<'_> RequestExt for Request<&'_ [u8]>[src]

Loading content...