Skip to content

Commit

Permalink
fix rustdoc caching tests
Browse files Browse the repository at this point in the history
  • Loading branch information
syphar committed Sep 8, 2022
1 parent 2db2d76 commit 4d78e03
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/web/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,14 +912,21 @@ mod test {
.archive_storage(true)
.rustdoc_file("dummy/index.html")
.create()?;
let resp = env.frontend().get("/dummy/latest/dummy/").send()?;
assert_eq!(resp.headers().get("Cache-Control").unwrap(), &"max-age=0");

let resp = env.frontend().get("/dummy/0.1.0/dummy/").send()?;
assert_eq!(
resp.headers().get("Cache-Control").unwrap(),
&"stale-while-revalidate=2592000, max-age=600"
);
let web = env.frontend();

{
let resp = web.get("/dummy/latest/dummy/").send()?;
assert_eq!(resp.headers().get("Cache-Control").unwrap(), &"max-age=0");
}

{
let resp = web.get("/dummy/0.1.0/dummy/").send()?;
assert_eq!(
resp.headers().get("Cache-Control").unwrap(),
&"stale-while-revalidate=2592000, max-age=600"
);
}
Ok(())
})
}
Expand Down

0 comments on commit 4d78e03

Please sign in to comment.