Skip to content

Conversation

@allenap
Copy link
Contributor

@allenap allenap commented Jun 16, 2024

The must-revalidate flag is supported. This adds the methods to test for its existence in and/or to add it to CacheControl.

Fixes #189.

@allenap
Copy link
Contributor Author

allenap commented Jun 16, 2024

Fwiw, my current workaround is borrowed from test_decode:

use headers::{self, HeaderMapExt};

fn decode<T: headers::Header>(values: &[&str]) -> Option<T> {
    let mut map = http::HeaderMap::new();
    for val in values {
        map.append(T::name(), val.parse().unwrap());
    }
    map.typed_get()
}

let cache_control = decode::<headers::CacheControl>(&["must-revalidate"]).unwrap();
let cache_control = Header(cache_control.with_public().with_max_age(Duration::ZERO));

@allenap allenap changed the title Add methods for with-revalidate flag to CacheControl Add methods for must-revalidate flag to CacheControl Jun 27, 2024
Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

@seanmonstar seanmonstar merged commit 879d2d4 into hyperium:master Jun 28, 2024
@allenap allenap deleted the must-revalidate branch July 24, 2024 08:19
@allenap allenap restored the must-revalidate branch July 26, 2024 10:47
@allenap allenap deleted the must-revalidate branch July 26, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CacheControl is missing methods for must-revalidate directive

2 participants