diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index fbccd42..10fe438 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -29,7 +29,7 @@ jobs: cargo llvm-cov --no-report --package http-cache-surf --features manager-moka cargo llvm-cov --no-report --package http-cache-reqwest --features manager-moka cargo llvm-cov report --lcov --output-path lcov.info - - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@v5 with: files: lcov.info fail_ci_if_error: false diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml index ffbd4c5..a581076 100644 --- a/.github/workflows/msrv.yml +++ b/.github/workflows/msrv.yml @@ -23,7 +23,7 @@ jobs: - uses: taiki-e/install-action@v2 with: tool: cargo-binstall - - run: cargo binstall --version 0.15.1 --no-confirm cargo-msrv + - run: cargo binstall --version 0.17.1 --no-confirm cargo-msrv - name: Run cargo msrv http-cache working-directory: ./http-cache run: cargo msrv verify @@ -33,3 +33,9 @@ jobs: - name: Run cargo msrv http-cache-darkbird working-directory: ./http-cache-darkbird run: cargo msrv verify + - name: Run cargo msrv http-cache-reqwest + working-directory: ./http-cache-reqwest + run: cargo msrv verify + - name: Run cargo msrv http-cache-surf + working-directory: ./http-cache-surf + run: cargo msrv verify diff --git a/.github/workflows/oranda.yml b/.github/workflows/oranda.yml index 284ea36..ec06f7e 100644 --- a/.github/workflows/oranda.yml +++ b/.github/workflows/oranda.yml @@ -15,11 +15,11 @@ jobs: - name: Install and run oranda run: | - curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/oranda/releases/download/v0.4.0/oranda-installer.sh | sh + curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/oranda/releases/download/v0.6.5/oranda-installer.sh | sh oranda build - name: Deploy to Github Pages - uses: JamesIves/github-pages-deploy-action@v4.6.9 + uses: JamesIves/github-pages-deploy-action@v4.7.2 if: ${{ github.ref == 'refs/heads/main' }} with: branch: gh-pages diff --git a/http-cache-darkbird/CHANGELOG.md b/http-cache-darkbird/CHANGELOG.md index def3d0a..f5a6b14 100644 --- a/http-cache-darkbird/CHANGELOG.md +++ b/http-cache-darkbird/CHANGELOG.md @@ -1,6 +1,18 @@ - # Changelog +## [0.3.1] - 2025-01-30 + +### Changed + +- MSRV is now 1.71.1 + +- Updated the minimum versions of the following dependencies: + - http-cache [0.21.1] + - async-trait [0.1.85] + - darkbird [6.2.4] + - serde [1.0.217] + - thiserror [2.0.11] + ## [0.3.0] - 2024-11-12 ### Changed diff --git a/http-cache-darkbird/Cargo.toml b/http-cache-darkbird/Cargo.toml index 73bb0a9..181e95f 100644 --- a/http-cache-darkbird/Cargo.toml +++ b/http-cache-darkbird/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http-cache-darkbird" -version = "0.3.0" +version = "0.3.1" description = "http-cache manager implementation for darkbird" authors = ["Christian Haynes <06chaynes@gmail.com>", "Kat Marchán "] repository = "https://github.com/06chaynes/http-cache" @@ -13,27 +13,27 @@ categories = [ "web-programming::http-client" ] edition = "2021" -rust-version = "1.70.0" +rust-version = "1.71.1" [dependencies] -async-trait = "0.1.72" -darkbird = "6.1.8" +async-trait = "0.1.85" +darkbird = "6.2.4" http-cache-semantics = "2.1.0" -serde = { version = "1.0.178", features = ["derive"] } -thiserror = "2.0.3" +serde = { version = "1.0.217", features = ["derive"] } +thiserror = "2.0.11" [dependencies.http-cache] path = "../http-cache" -version = "0.20.0" +version = "0.20.1" default-features = false [dev-dependencies] -http = "1.1.0" -reqwest = { version = "0.12.3", default-features = false } +http = "1.2.0" +reqwest = { version = "0.12.12", default-features = false } reqwest-middleware = "0.4.0" -tokio = { version = "1.29.1", features = [ "macros", "rt", "rt-multi-thread" ] } -wiremock = "0.6.0" -url = { version = "2.4.0", features = ["serde"] } +tokio = { version = "1.43.0", features = [ "macros", "rt", "rt-multi-thread" ] } +wiremock = "0.6.2" +url = { version = "2.5.4", features = ["serde"] } [dev-dependencies.http-cache-reqwest] path = "../http-cache-reqwest" diff --git a/http-cache-darkbird/README.md b/http-cache-darkbird/README.md index bc58a67..90e3f68 100644 --- a/http-cache-darkbird/README.md +++ b/http-cache-darkbird/README.md @@ -12,7 +12,7 @@ An http-cache manager implementation for [darkbird](https://github.com/Rustixir/ ## Minimum Supported Rust Version (MSRV) -1.70.0 +1.71.1 ## Install diff --git a/http-cache-mokadeser/CHANGELOG.md b/http-cache-mokadeser/CHANGELOG.md index c6440a1..e218c2c 100644 --- a/http-cache-mokadeser/CHANGELOG.md +++ b/http-cache-mokadeser/CHANGELOG.md @@ -1,6 +1,16 @@ - # Changelog +## [0.3.1] - 2025-01-30 + +### Changed + +- MSRV is now 1.71.1 + +- Updated the minimum versions of the following dependencies: + - http-cache [0.21.1] + - async-trait [0.1.85] + - moka [0.12.10] + ## [0.3.0] - 2024-11-12 ### Changed diff --git a/http-cache-mokadeser/Cargo.toml b/http-cache-mokadeser/Cargo.toml index c3694a1..b49a915 100644 --- a/http-cache-mokadeser/Cargo.toml +++ b/http-cache-mokadeser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http-cache-mokadeser" -version = "0.3.0" +version = "0.3.1" description = "http-cache manager implementation for moka stored deserialized" authors = ["Christian Haynes <06chaynes@gmail.com>", "Kat Marchán "] repository = "https://github.com/06chaynes/http-cache" @@ -13,26 +13,26 @@ categories = [ "web-programming::http-client" ] edition = "2021" -rust-version = "1.67.1" +rust-version = "1.71.1" [dependencies] -async-trait = "0.1.72" +async-trait = "0.1.85" http-cache-semantics = "2.1.0" -moka = { version = "0.12.0", features = ["future"]} +moka = { version = "0.12.10", features = ["future"]} [dependencies.http-cache] path = "../http-cache" -version = "0.20.0" +version = "0.20.1" default-features = false features = ["bincode"] [dev-dependencies] -http = "1.1.0" -reqwest = { version = "0.12.3", default-features = false } +http = "1.2.0" +reqwest = { version = "0.12.12", default-features = false } reqwest-middleware = "0.4.0" -tokio = { version = "1.29.1", features = [ "macros", "rt", "rt-multi-thread" ] } -url = { version = "2.4.0", features = ["serde"] } -wiremock = "0.6.0" +tokio = { version = "1.43.0", features = [ "macros", "rt", "rt-multi-thread" ] } +url = { version = "2.5.4", features = ["serde"] } +wiremock = "0.6.2" [dev-dependencies.http-cache-reqwest] path = "../http-cache-reqwest" diff --git a/http-cache-mokadeser/README.md b/http-cache-mokadeser/README.md index 130f180..da84686 100644 --- a/http-cache-mokadeser/README.md +++ b/http-cache-mokadeser/README.md @@ -12,7 +12,7 @@ An http-cache manager implementation for [moka](https://github.com/moka-rs/moka) ## Minimum Supported Rust Version (MSRV) -1.67.1 +1.71.1 ## Install diff --git a/http-cache-quickcache/CHANGELOG.md b/http-cache-quickcache/CHANGELOG.md index 42a0485..12e8e11 100644 --- a/http-cache-quickcache/CHANGELOG.md +++ b/http-cache-quickcache/CHANGELOG.md @@ -1,6 +1,16 @@ - # Changelog +## [0.8.1] - 2025-01-30 + +### Changed + +- Updated the minimum versions of the following dependencies: + - http-cache [0.21.1] + - async-trait [0.1.85] + - darkbird [6.2.4] + - serde [1.0.217] + - url [2.5.4] + ## [0.8.0] - 2024-11-12 ### Changed diff --git a/http-cache-quickcache/Cargo.toml b/http-cache-quickcache/Cargo.toml index d27253c..836c6d1 100644 --- a/http-cache-quickcache/Cargo.toml +++ b/http-cache-quickcache/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http-cache-quickcache" -version = "0.8.0" +version = "0.8.1" description = "http-cache manager implementation for quick-cache" authors = ["Christian Haynes <06chaynes@gmail.com>", "Kat Marchán "] repository = "https://github.com/06chaynes/http-cache" @@ -16,25 +16,25 @@ edition = "2021" rust-version = "1.71.1" [dependencies] -async-trait = "0.1.72" +async-trait = "0.1.85" bincode = "1.3.3" http-cache-semantics = "2.1.0" -serde = { version = "1.0.178", features = ["derive"] } -url = { version = "2.4.0", features = ["serde"] } +serde = { version = "1.0.217", features = ["derive"] } +url = { version = "2.5.4", features = ["serde"] } quick_cache = "0.6.9" [dependencies.http-cache] path = "../http-cache" -version = "0.20.0" +version = "0.20.1" default-features = false features = ["bincode"] [dev-dependencies] -http = "1.1.0" -reqwest = { version = "0.12.3", default-features = false } +http = "1.2.0" +reqwest = { version = "0.12.12", default-features = false } reqwest-middleware = "0.4.0" -tokio = { version = "1.29.1", features = [ "macros", "rt", "rt-multi-thread" ] } -wiremock = "0.6.0" +tokio = { version = "1.43.0", features = [ "macros", "rt", "rt-multi-thread" ] } +wiremock = "0.6.2" [dev-dependencies.http-cache-reqwest] path = "../http-cache-reqwest" diff --git a/http-cache-reqwest/CHANGELOG.md b/http-cache-reqwest/CHANGELOG.md index fd2ddeb..2d4221b 100644 --- a/http-cache-reqwest/CHANGELOG.md +++ b/http-cache-reqwest/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [0.15.1] - 2025-01-30 + +### Changed + +- Updated the minimum versions of the following dependencies: + - http-cache [0.21.1] + - anyhow [1.0.95] + - async-trait [0.1.85] + - http [1.2.0] + - reqwest [0.12.12] + - serde [1.0.217] + - url [2.5.4] + ## [0.15.0] - 2024-11-12 ### Changed diff --git a/http-cache-reqwest/Cargo.toml b/http-cache-reqwest/Cargo.toml index 4f5f45d..3fbfd96 100644 --- a/http-cache-reqwest/Cargo.toml +++ b/http-cache-reqwest/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http-cache-reqwest" -version = "0.15.0" +version = "0.15.1" description = "http-cache middleware implementation for reqwest" authors = ["Christian Haynes <06chaynes@gmail.com>", "Kat Marchán "] repository = "https://github.com/06chaynes/http-cache" @@ -13,24 +13,25 @@ categories = [ "web-programming::http-client" ] edition = "2021" +rust-version = "1.71.1" [dependencies] -anyhow = "1.0.72" -async-trait = "0.1.72" -http = "1.1.0" +anyhow = "1.0.95" +async-trait = "0.1.85" +http = "1.2.0" http-cache-semantics = "2.1.0" -reqwest = { version = "0.12.3", default-features = false } +reqwest = { version = "0.12.12", default-features = false } reqwest-middleware = "0.4.0" -serde = { version = "1.0.178", features = ["derive"] } -url = { version = "2.4.0", features = ["serde"] } +serde = { version = "1.0.217", features = ["derive"] } +url = { version = "2.5.4", features = ["serde"] } [dependencies.http-cache] path = "../http-cache" -version = "0.20.0" +version = "0.20.1" default-features = false [dev-dependencies] -tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] } wiremock = "0.6.0" [features] diff --git a/http-cache-reqwest/README.md b/http-cache-reqwest/README.md index 7589b31..bb3c2ae 100644 --- a/http-cache-reqwest/README.md +++ b/http-cache-reqwest/README.md @@ -15,7 +15,7 @@ Uses [reqwest-middleware](https://github.com/TrueLayer/reqwest-middleware) for m ## Minimum Supported Rust Version (MSRV) -1.67.1 +1.71.1 ## Install diff --git a/http-cache-reqwest/src/test.rs b/http-cache-reqwest/src/test.rs index 605536f..f182f40 100644 --- a/http-cache-reqwest/src/test.rs +++ b/http-cache-reqwest/src/test.rs @@ -136,6 +136,45 @@ async fn no_cache_mode() -> Result<()> { Ok(()) } +#[tokio::test] +async fn reload_mode() -> Result<()> { + let mock_server = MockServer::start().await; + let m = build_mock(CACHEABLE_PUBLIC, TEST_BODY, 200, 2); + let _mock_guard = mock_server.register_as_scoped(m).await; + let url = format!("{}/", &mock_server.uri()); + let manager = MokaManager::default(); + + // Construct reqwest client with cache options override + let client = ClientBuilder::new(Client::new()) + .with(Cache(HttpCache { + mode: CacheMode::Reload, + manager: manager.clone(), + options: HttpCacheOptions { + cache_key: None, + cache_options: Some(CacheOptions { + shared: false, + ..Default::default() + }), + cache_mode_fn: None, + cache_bust: None, + cache_status_headers: true, + }, + })) + .build(); + + // Cold pass to load cache + client.get(url.clone()).send().await?; + + // Try to load cached object + let data = manager.get(&format!("{}:{}", GET, &Url::parse(&url)?)).await?; + assert!(data.is_some()); + + // Another pass to make sure request is made to the endpoint + client.get(url).send().await?; + + Ok(()) +} + #[tokio::test] async fn custom_cache_key() -> Result<()> { let mock_server = MockServer::start().await; diff --git a/http-cache-surf/CHANGELOG.md b/http-cache-surf/CHANGELOG.md index 7f676c9..4087740 100644 --- a/http-cache-surf/CHANGELOG.md +++ b/http-cache-surf/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [0.14.1] - 2025-01-30 + +### Changed + +- Updated the minimum versions of the following dependencies: + - http-cache [0.21.1] + - anyhow [1.0.95] + - async-trait [0.1.85] + - http [1.2.0] + - serde [1.0.217] + - url [2.5.4] + - thiserror [2.0.11] + ## [0.14.0] - 2024-11-12 ### Changed diff --git a/http-cache-surf/Cargo.toml b/http-cache-surf/Cargo.toml index 4d41621..26d0b2c 100644 --- a/http-cache-surf/Cargo.toml +++ b/http-cache-surf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http-cache-surf" -version = "0.14.0" +version = "0.14.1" description = "http-cache middleware implementation for surf" authors = ["Christian Haynes <06chaynes@gmail.com>", "Kat Marchán "] repository = "https://github.com/06chaynes/http-cache" @@ -13,28 +13,29 @@ categories = [ "web-programming::http-client" ] edition = "2021" +rust-version = "1.71.1" [dependencies] -anyhow = "1.0.72" -async-trait = "0.1.72" -http = "1.1.0" +anyhow = "1.0.95" +async-trait = "0.1.85" +http = "1.2.0" http-cache-semantics = "2.1.0" http-types = "2.12.0" -serde = { version = "1.0.178", features = ["derive"] } +serde = { version = "1.0.217", features = ["derive"] } surf = { version = "2.3.2", default-features = false } -url = { version = "2.4.0", features = ["serde"] } -thiserror = "2.0.3" +url = { version = "2.5.4", features = ["serde"] } +thiserror = "2.0.11" [dependencies.http-cache] path = "../http-cache" -version = "0.20.0" +version = "0.20.1" default-features = false features = ["with-http-types"] [dev-dependencies] -async-std = { version = "1.12.0", features = ["attributes"] } +async-std = { version = "1.13.0", features = ["attributes"] } surf = { version = "2.3.2", features = ["curl-client"] } -wiremock = "0.6.0" +wiremock = "0.6.2" [features] default = ["manager-cacache"] diff --git a/http-cache-surf/README.md b/http-cache-surf/README.md index 8f90c36..ca95572 100644 --- a/http-cache-surf/README.md +++ b/http-cache-surf/README.md @@ -15,7 +15,7 @@ Should likely be registered after any middleware modifying the request. ## Minimum Supported Rust Version (MSRV) -1.67.1 +1.71.1 ## Install diff --git a/http-cache/CHANGELOG.md b/http-cache/CHANGELOG.md index 639ee6b..ed34a26 100644 --- a/http-cache/CHANGELOG.md +++ b/http-cache/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [0.20.1] - 2025-01-30 + +### Changed + +- Fixed missing implementation of CacheMode::Reload variant logic. + +- MSRV is now 1.71.1 + +- Updated the minimum versions of the following dependencies: + - async-trait [0.1.85] + - cacache [13.1.0] + - httpdate [1.0.2] + - moka [0.12.10] + - serde [1.0.217] + - url [2.5.4] + ## [0.20.0] - 2024-11-12 ### Added diff --git a/http-cache/Cargo.toml b/http-cache/Cargo.toml index 017ea91..7e0aff9 100644 --- a/http-cache/Cargo.toml +++ b/http-cache/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http-cache" -version = "0.20.0" +version = "0.20.1" description = "An HTTP caching middleware" authors = ["Christian Haynes <06chaynes@gmail.com>", "Kat Marchán "] repository = "https://github.com/06chaynes/http-cache" @@ -13,25 +13,25 @@ categories = [ "web-programming::http-client" ] edition = "2021" -rust-version = "1.67.1" +rust-version = "1.71.1" [dependencies] -async-trait = "0.1.72" +async-trait = "0.1.85" bincode = { version = "1.3.3", optional = true } -cacache = { version = "13.0.0", default-features = false, features = ["mmap"], optional = true } -http = "1.1.0" +cacache = { version = "13.1.0", default-features = false, features = ["mmap"], optional = true } +http = "1.2.0" http-cache-semantics = "2.1.0" http-types = { version = "2.12.0", default-features = false, optional = true } -httpdate = "1.0.2" -moka = { version = "0.12.0", features = ["future"], optional = true } -serde = { version = "1.0.178", features = ["derive"] } -url = { version = "2.4.0", features = ["serde"] } +httpdate = "1.0.3" +moka = { version = "0.12.10", features = ["future"], optional = true } +serde = { version = "1.0.217", features = ["derive"] } +url = { version = "2.5.4", features = ["serde"] } [dev-dependencies] async-attributes = "1.1.2" -async-std = { version = "1.12.0" } +async-std = { version = "1.13.0" } http-cache-semantics = "2.1.0" -tokio = { version = "1.29.1", features = [ "macros", "rt", "rt-multi-thread" ] } +tokio = { version = "1.43.0", features = [ "macros", "rt", "rt-multi-thread" ] } [features] default = ["manager-cacache", "cacache-async-std"] diff --git a/http-cache/README.md b/http-cache/README.md index 9e06a1f..d141d78 100644 --- a/http-cache/README.md +++ b/http-cache/README.md @@ -20,7 +20,7 @@ See the [Provided Client Implementations](#provided-client-implementations) sect ## Minimum Supported Rust Version (MSRV) -1.67.1 +1.71.1 ## Install diff --git a/http-cache/src/lib.rs b/http-cache/src/lib.rs index ad4a4e6..fcb17cf 100644 --- a/http-cache/src/lib.rs +++ b/http-cache/src/lib.rs @@ -198,7 +198,7 @@ impl HttpResponse { /// Checks if the Cache-Control header contains the must-revalidate directive #[must_use] pub fn must_revalidate(&self) -> bool { - self.headers.get(CACHE_CONTROL.as_str()).map_or(false, |val| { + self.headers.get(CACHE_CONTROL.as_str()).is_some_and(|val| { val.as_str().to_lowercase().contains("must-revalidate") }) } @@ -458,9 +458,7 @@ impl HttpCache { let mode = self.cache_mode(middleware)?; Ok(mode == CacheMode::IgnoreRules - || middleware.is_method_get_head() - && mode != CacheMode::NoStore - && mode != CacheMode::Reload) + || middleware.is_method_get_head() && mode != CacheMode::NoStore) } /// Runs the actions to preform when the client middleware is running without the cache @@ -617,7 +615,6 @@ impl HttpCache { let mode = self.cache_mode(middleware)?; let mut is_cacheable = is_get_head && mode != CacheMode::NoStore - && mode != CacheMode::Reload && res.status == 200 && policy.is_storable(); if mode == CacheMode::IgnoreRules && res.status == 200 {