[−][src]Trait fastly::request::RequestExt
A Fastly-specific extension trait for Request
s.
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.
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]
self,
backend: &str
) -> Result<(StreamingBody, PendingRequest), SendError>
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.
Implementors
impl RequestExt for Request<&str>
[src]
pub fn inner_to_body(self) -> Request<Body>
[src]
pub fn inner_to_bytes(self) -> Result<Request<Vec<u8>>, Error>
[src]
pub fn fastly_metadata(&self) -> &FastlyRequestMetadata
[src]
pub fn fastly_metadata_mut(&mut self) -> &mut FastlyRequestMetadata
[src]
impl RequestExt for Request<&[u8]>
[src]
pub fn inner_to_body(self) -> Request<Body>
[src]
pub fn inner_to_bytes(self) -> Result<Request<Vec<u8>>, Error>
[src]
pub fn fastly_metadata(&self) -> &FastlyRequestMetadata
[src]
pub fn fastly_metadata_mut(&mut self) -> &mut FastlyRequestMetadata
[src]
impl RequestExt for Request<()>
[src]
pub fn inner_to_body(self) -> Request<Body>
[src]
pub fn inner_to_bytes(self) -> Result<Request<Vec<u8>>, Error>
[src]
pub fn fastly_metadata(&self) -> &FastlyRequestMetadata
[src]
pub fn fastly_metadata_mut(&mut self) -> &mut FastlyRequestMetadata
[src]
impl RequestExt for Request<Body>
[src]
pub fn send(self, backend: &str) -> Result<Response<Body>, SendError>
[src]
pub fn send_async(self, backend: &str) -> Result<PendingRequest, SendError>
[src]
pub fn send_async_streaming(
self,
backend: &str
) -> Result<(StreamingBody, PendingRequest), SendError>
[src]
self,
backend: &str
) -> Result<(StreamingBody, PendingRequest), SendError>