#2666·actix-web

`CacheDirective` enum is missing some directives

Author: ssokolowCreated Feb 26, 2022Updated Jul 31, 2026
LabelsC-improvementA-web

Expected Behavior

I should be able to use CacheDirective::Immutable for implementing Cache-Control headers for the cache-busting pattern.

Current Behavior

I have to use CacheDirective::Extension("immutable".to_owned(), None)

Possible Solution

Add CacheDirective variants for the following variants listed on MDN but missing from the enum:

  • must-understand
  • immutable
  • stale-while-revalidate
  • stale-if-error

Your Environment

  • Rust Version (I.e, output of rustc -V): rustc 1.59.0 (9d1b2106e 2022-02-23)
  • Actix Web Version: 4.0.1