Skip to content

Commit 92a393b

Browse files
committed
change NoCache policy to just max-age=0 to allow back-forward cache in the browser
1 parent 2f39aff commit 92a393b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/web/cache.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use iron::{
66
};
77

88
#[cfg(test)]
9-
pub const NO_CACHE: &str = "no-cache, max-age=0";
9+
pub const NO_CACHE: &str = "max-age=0";
1010

1111
/// defines the wanted caching behaviour for a web response.
1212
pub enum CachePolicy {
@@ -40,7 +40,7 @@ impl CachePolicy {
4040
pub fn render(&self, config: &Config) -> Vec<CacheDirective> {
4141
match *self {
4242
CachePolicy::NoCaching => {
43-
vec![CacheDirective::NoCache, CacheDirective::MaxAge(0)]
43+
vec![CacheDirective::MaxAge(0)]
4444
}
4545
CachePolicy::NoStoreMustRevalidate => {
4646
vec![
@@ -118,7 +118,7 @@ mod tests {
118118
use iron::headers::CacheControl;
119119
use test_case::test_case;
120120

121-
#[test_case(CachePolicy::NoCaching, "no-cache, max-age=0")]
121+
#[test_case(CachePolicy::NoCaching, "max-age=0")]
122122
#[test_case(
123123
CachePolicy::NoStoreMustRevalidate,
124124
"no-cache, no-store, must-revalidate, max-age=0"

0 commit comments

Comments
 (0)