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

pub trait RequestExt: Sized {
    pub fn inner_to_body(self) -> Request<Body>;
pub fn inner_to_bytes(self) -> Result<Request<Vec<u8>>, Error>;
pub fn fastly_metadata(&self) -> &FastlyRequestMetadata;
pub fn fastly_metadata_mut(&mut self) -> &mut FastlyRequestMetadata; pub fn send(self, backend: &str) -> Result<Response<Body>, SendError> { ... }
pub fn send_async(self, backend: &str) -> Result<PendingRequest, SendError> { ... }
pub fn send_async_streaming(
        self,
        backend: &str
    ) -> Result<(StreamingBody, PendingRequest), SendError> { ... }
pub fn cache_override_mut(&mut self) -> &mut CacheOverride { ... }
pub fn cache_override(&self) -> &CacheOverride { ... }
pub fn set_pass(&mut self) { ... }
pub fn set_ttl(&mut self, ttl: u32) { ... }
pub fn set_stale_while_revalidate(&mut self, swr: u32) { ... }
pub fn set_pci(&mut self, pci: bool) { ... }
pub fn set_surrogate_key(&mut self, surrogate_key: HeaderValue) { ... } }

A Fastly-specific extension trait for Requests.

This is most commonly used to send a request to a backend associated with a Compute@Edge service.

Required methods

pub fn inner_to_body(self) -> Request<Body>[src]

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

pub fn inner_to_bytes(self) -> Result<Request<Vec<u8>>, Error>[src]

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.

pub fn fastly_metadata(&self) -> &FastlyRequestMetadata[src]

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

pub fn fastly_metadata_mut(&mut self) -> &mut FastlyRequestMetadata[src]

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

Loading content...

Provided methods

pub fn send(self, backend: &str) -> Result<Response<Body>, SendError>[src]

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

pub fn send_async(self, backend: &str) -> Result<PendingRequest, SendError>[src]

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.

pub fn send_async_streaming(
    self,
    backend: &str
) -> Result<(StreamingBody, PendingRequest), SendError>
[src]

Send a request asynchronously via the given backend, and return a StreamingBody to allow continued writes to the request body.

The resulting StreamingBody must be dropped in order to finish sending the request.

pub fn cache_override_mut(&mut self) -> &mut CacheOverride[src]

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()).

pub fn cache_override(&self) -> &CacheOverride[src]

Get the cache override behavior for this request.

pub fn set_pass(&mut self)[src]

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.

pub fn set_ttl(&mut self, ttl: u32)[src]

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.

pub fn set_stale_while_revalidate(&mut self, swr: u32)[src]

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.

pub fn set_pci(&mut self, pci: bool)[src]

Set the cache override behavior for this request to enable or disable PCI/HIPAA non-volatile caching.

See https://docs.fastly.com/products/pci-compliant-caching-and-delivery for more information.

This option may combined with TTL and stale-while-revalidate options.

This will override any previous calls on this request to set Pass.

pub fn set_surrogate_key(&mut self, surrogate_key: HeaderValue)[src]

Set a Surrogate-Key for a cached response.

See https://docs.fastly.com/en/guides/purging-api-cache-with-surrogate-keys for more information on how Surrogate Keys can be used.

This option may be combined with any other caching option. This will override any previous calls on this request to set Pass.

The keys implied here will be added to any Surrogate-Key response header from the origin.

Loading content...

Implementors

impl RequestExt for Request<&str>[src]

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

impl RequestExt for Request<()>[src]

impl RequestExt for Request<Body>[src]

impl RequestExt for Request<String>[src]

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

Loading content...