@@ -26,6 +26,7 @@ module Network.Wai.Application.Static
2626 -- * WAI application
2727 , StaticSettings (..)
2828 , staticApp
29+ , staticAppPieces
2930 ) where
3031
3132import qualified Network.Wai as W
@@ -233,13 +234,17 @@ data StaticSettings = StaticSettings
233234 }
234235
235236staticApp :: StaticSettings -> W.Application
236−staticApp _ req
237+staticApp set req = do
238+ let pieces = decodePathInfo $ S8.unpack $ W.pathInfo req
239+ staticAppPieces set pieces req
240+
241+staticAppPieces :: StaticSettings -> [String] -> W.Application
242+staticAppPieces _ _ req
237243 | W.requestMethod req /= "GET" = return $ W.responseLBS
238244 W.status405
239245 [("Content-Type", "text/plain")]
240246 "Only GET is supported"
241−staticApp (StaticSettings folder indices mlisting getmime) req = liftIO $ do
242− let pieces = decodePathInfo $ S8.unpack $ W.pathInfo req
247+staticAppPieces (StaticSettings folder indices mlisting getmime) pieces _ = liftIO $ do
243248 cp <- checkPieces folder indices pieces
244249 case cp of
245250 Redirect pieces' -> do