From e0aeb8aa134bd7fe93526a32b004e77b267a3ba2 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 4 Jun 2020 00:45:39 -0400 Subject: Be more explicit about caching --- src/view.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/view.rs b/src/view.rs index 3417e0f..1daa240 100644 --- a/src/view.rs +++ b/src/view.rs @@ -43,7 +43,7 @@ //! links to existing items are not invalidated or changed - the `item` //! parameter to the `/` endpoint is a literal index into this list. -use actix_web::{get, error, web}; +use actix_web::{get, error, web, Responder}; use maud::{DOCTYPE, html, Markup, PreEscaped}; use pulldown_cmark::{Parser, Options, html}; use rand::thread_rng; @@ -169,7 +169,7 @@ async fn index( req: web::HttpRequest, data: web::Data, query: web::Query, -) -> error::Result { +) -> error::Result { let thing = match query.item { Some(index) => data.0.get(index), None => data.0.choose(&mut thread_rng()), @@ -180,7 +180,8 @@ async fn index( None => return Err(error::ErrorNotFound("Not found")), }; - Ok(index_view(req, index, thing)?) + Ok(index_view(req, index, thing)? + .with_header("Cache-Control", "no-store")) } const THINGS: &str = include_str!("things-to-check.yml"); -- cgit v1.2.3