Skip to content

Commit

Permalink
Merge pull request #977 from blackheaven/wai-app-static/max-age-no-cache
Browse files Browse the repository at this point in the history
wai-app-static: add NoCache to MaxAge
  • Loading branch information
snoyberg authored Mar 4, 2024
2 parents 6cf32e9 + 495d863 commit 4d2f12c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions wai-app-static/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# wai-app-static changelog

## 3.1.9

* Added `NoCache` constructor to `MaxAge` [#977](https://github.com/yesodweb/wai/pull/977)

## 3.1.8

* Added `NoStore` constructor to `MaxAge` [#938](https://github.com/yesodweb/wai/pull/938)
Expand Down
2 changes: 2 additions & 0 deletions wai-app-static/Network/Wai/Application/Static.hs
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,14 @@ cacheControl maxage =
MaxAgeSeconds i -> (:) ("Cache-Control", maxAgeValue i)
MaxAgeForever -> (:) ("Cache-Control", maxAgeValue oneYear)
NoStore -> (:) ("Cache-Control", "no-store")
NoCache -> (:) ("Cache-Control", "no-cache")
headerExpires =
case maxage of
NoMaxAge -> id
MaxAgeSeconds _ -> id -- FIXME
MaxAgeForever -> (:) ("Expires", "Thu, 31 Dec 2037 23:55:55 GMT")
NoStore -> id
NoCache -> id

-- | Turn a @StaticSettings@ into a WAI application.
staticApp :: StaticSettings -> W.Application
Expand Down
2 changes: 2 additions & 0 deletions wai-app-static/WaiAppStatic/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ data MaxAge
MaxAgeForever
| -- | set cache-control to no-store @since 3.1.8
NoStore
| -- | set cache-control to no-cache @since 3.1.9
NoCache

-- | Just the name of a folder.
type FolderName = Piece
Expand Down
2 changes: 1 addition & 1 deletion wai-app-static/wai-app-static.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wai-app-static
version: 3.1.8
version: 3.1.9
license: MIT
license-file: LICENSE
author: Michael Snoyman <[email protected]>
Expand Down

0 comments on commit 4d2f12c

Please sign in to comment.