From 4d78e036bf96a3b5ba5485b2aa843fa032220699 Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Wed, 7 Sep 2022 22:57:23 +0200 Subject: [PATCH] fix rustdoc caching tests --- src/web/rustdoc.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/web/rustdoc.rs b/src/web/rustdoc.rs index ad1dc4f73..518f1d488 100644 --- a/src/web/rustdoc.rs +++ b/src/web/rustdoc.rs @@ -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(()) }) }