Set nocache for templates

This commit is contained in:
Hubert Van De Walle 2020-08-24 00:29:15 +02:00
parent cbc3a017e8
commit d6ab257473
2 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,9 @@ import org.http4k.core.Response
import org.http4k.core.Status.Companion.FOUND
import org.http4k.core.Status.Companion.MOVED_PERMANENTLY
fun Response.html(html: String) = body(html).header("Content-Type", "text/html; charset=utf-8")
fun Response.html(html: String) = body(html)
.header("Content-Type", "text/html; charset=utf-8")
.header("Cache-Control", "no-cache")
fun Response.Companion.redirect(url: String, permanent: Boolean = false) =
Response(if (permanent) MOVED_PERMANENTLY else FOUND).header("Location", url)

View File

@ -36,7 +36,7 @@ class BaseView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
<form class="md:space-x-2" id="search">
<input aria-label="demo-search" name="search" disabled="" value="tag:&quot;demo&quot;">
<span id="buttons">
<button disabled="" class="btn btn-green pointer-events-none">search</button>
<button type="button" disabled="" class="btn btn-green pointer-events-none">search</button>
<span class="btn btn-red pointer-events-none">clear</span>
</span>
</form>