diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2020-06-04 00:45:39 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2020-06-04 00:45:39 -0400 |
| commit | e0aeb8aa134bd7fe93526a32b004e77b267a3ba2 (patch) | |
| tree | 79e5c9ad8677c97b0ed9d4ccaddfca7207e9f36c | |
| parent | eed33b0611766024751d93e8ec02aac243961acf (diff) | |
Be more explicit about caching
| -rw-r--r-- | src/view.rs | 7 |
1 files 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<Things>, query: web::Query<ItemQuery>, -) -> error::Result<Markup> { +) -> error::Result<impl Responder> { 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"); |
