Crate http_cache_stream_reqwest

Source
Expand description

An implementation of a reqwest middleware that uses http-cache-stream.

use http_cache_stream_reqwest::Cache;
use http_cache_stream_reqwest::storage::DefaultCacheStorage;
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
use reqwest_middleware::Result;

#[tokio::main]
async fn main() -> Result<()> {
    let client = ClientBuilder::new(Client::new())
        .with(Cache::new(DefaultCacheStorage::new("./cache")))
        .build();
    client.get("https://example.com").send().await?;
    Ok(())
}

Modules§

storage
Implementation of cache storage.

Structs§

Cache
Implements a caching middleware for reqwest.
CacheOptions
Configuration options which control behavior of the cache. Use with CachePolicy::new_options().

Constants§

X_CACHE
The name of the x-cache custom header.
X_CACHE_DIGEST
The name of the x-cache-digest custom header.
X_CACHE_LOOKUP
The name of the x-cache-lookup custom header.

Traits§

CacheStorage
A trait implemented on cache storage.