on master help sign in
add default value for new 404 handler setting
commit914cacdc0c7c5439041c9dac293594311469c85c authorJason Hickner <jhickner@gmail.com> dateWed 18 Nov 2015, 14:41 (11 years ago) parentd7ffe3a
2 files changed+5−1
wai-app-static/Network/Wai/Application/Static.hs+3−1 wai-app-static/WaiAppStatic/Storage/Filesystem.hs+2
wai-app-static/Network/Wai/Application/Static.hs+3−1
@@ -255,7 +255,9 @@ staticAppPieces ss rawPieces req sendResponse = liftIO $ do
255255 , ("Location", path)
256256 ] "Redirect"
257257
258− response NotFound = sendResponse $ W.responseLBS H.status404
258+ response NotFound = case (ss404Handler ss) of
259+ Just app -> app req sendResponde
260+ Nothing -> sendResponse $ W.responseLBS H.status404
259261 [ ("Content-Type", "text/plain")
260262 ] "File not found"
261263
wai-app-static/WaiAppStatic/Storage/Filesystem.hs+2
@@ -47,6 +47,7 @@ defaultWebAppSettings root = StaticSettings
4747 , ssRedirectToIndex = False
4848 , ssUseHash = True
4949 , ssAddTrailingSlash = False
50+ , ss404Handler = Nothing
5051 }
5152
5253-- | Settings optimized for a file server. More conservative caching will be
@@ -63,6 +64,7 @@ defaultFileServerSettings root = StaticSettings
6364 , ssRedirectToIndex = False
6465 , ssUseHash = False
6566 , ssAddTrailingSlash = False
67+ , ss404Handler = Nothing
6668 }
6769
6870-- | Same as @defaultWebAppSettings@, but additionally uses a specialized