wai-app-static 3.1.2 → 3.1.3
raw patch · 5 files changed
+16/−2 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Network.Wai.Application.Static: ss404Handler :: StaticSettings -> Maybe Application
+ WaiAppStatic.Types: [ss404Handler] :: StaticSettings -> Maybe Application
- WaiAppStatic.Types: StaticSettings :: (Pieces -> IO LookupResult) -> (File -> IO MimeType) -> [Piece] -> Maybe Listing -> MaxAge -> (Pieces -> ByteString -> ByteString) -> Bool -> Bool -> Bool -> StaticSettings
+ WaiAppStatic.Types: StaticSettings :: (Pieces -> IO LookupResult) -> (File -> IO MimeType) -> [Piece] -> Maybe Listing -> MaxAge -> (Pieces -> ByteString -> ByteString) -> Bool -> Bool -> Bool -> Maybe Application -> StaticSettings
Files
- ChangeLog.md +4/−0
- Network/Wai/Application/Static.hs +4/−1
- WaiAppStatic/Storage/Filesystem.hs +2/−0
- WaiAppStatic/Types.hs +5/−0
- wai-app-static.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 3.1.3++* Add 404 handler [#467](https://github.com/yesodweb/wai/pull/467)+ ## 3.1.2 * Honor ssIndices when used with defaultWebAppSettings [#460](https://github.com/yesodweb/wai/pull/460)
Network/Wai/Application/Static.hs view
@@ -22,6 +22,7 @@ , ssMaxAge , ssRedirectToIndex , ssAddTrailingSlash+ , ss404Handler ) where import Prelude hiding (FilePath)@@ -255,7 +256,9 @@ , ("Location", path) ] "Redirect" - response NotFound = sendResponse $ W.responseLBS H.status404+ response NotFound = case (ss404Handler ss) of+ Just app -> app req sendResponse+ Nothing -> sendResponse $ W.responseLBS H.status404 [ ("Content-Type", "text/plain") ] "File not found"
WaiAppStatic/Storage/Filesystem.hs view
@@ -47,6 +47,7 @@ , ssRedirectToIndex = False , ssUseHash = True , ssAddTrailingSlash = False+ , ss404Handler = Nothing } -- | Settings optimized for a file server. More conservative caching will be@@ -63,6 +64,7 @@ , ssRedirectToIndex = False , ssUseHash = False , ssAddTrailingSlash = False+ , ss404Handler = Nothing } -- | Same as @defaultWebAppSettings@, but additionally uses a specialized
WaiAppStatic/Types.hs view
@@ -144,4 +144,9 @@ -- | Force a trailing slash at the end of directories , ssAddTrailingSlash :: Bool++ -- | Optional `W.Application` to be used in case of 404 errors+ --+ -- Since 3.1.3+ , ss404Handler :: Maybe W.Application }
wai-app-static.cabal view
@@ -1,5 +1,5 @@ name: wai-app-static-version: 3.1.2+version: 3.1.3 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>