actix-web
                                
                                 actix-web copied to clipboard
                                
                                    actix-web copied to clipboard
                            
                            
                            
                        `CacheDirective` enum is missing some directives
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
shame this wasn't caught before stable v4 :/
you can implement your own typed headers though
shame this wasn't caught before stable v4 :/
Yeah, especially since it was just coincidence that I happened to be preparing to get back to work on the project in question around the v4 release.
To be honest, I'm surprised you didn't mark that enum nonexhaustive.
you can implement your own typed headers though
Not really worth the trouble. I only use it in one place (a helper macro for asset routes), so it's more about moving the responsibility for ensuring typos don't creep in to somewhere with more eyeballs.
Since this can't be fixed until v5, I added an updated verison to actix-web-lab: https://docs.rs/actix-web-lab/0.15.0/actix_web_lab/header/struct.CacheControl.html.