web-routes-wai 0.23.2 → 0.24.0
raw patch · 2 files changed
+11/−11 lines, 2 filesdep ~waiPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: wai
API changes (from Hackage documentation)
Files
- Web/Routes/Wai.hs +9/−9
- web-routes-wai.cabal +2/−2
Web/Routes/Wai.hs view
@@ -22,11 +22,11 @@ -> ((url -> [(Text, Maybe Text)] -> Text) -> url -> Application) -- ^ routing function -> Application handleWaiError fromUrl toUrl approot handleError handler =- \request ->+ \request respond -> do let fUrl = toUrl $ stripOverlapBS approot $ rawPathInfo request case fUrl of- (Left parseError) -> handleError parseError request- (Right url) -> handler (\url params -> (Text.decodeUtf8 approot) `Text.append` (fromUrl url params)) url request+ (Left parseError) -> handleError parseError request respond+ (Right url) -> handler (\url params -> (Text.decodeUtf8 approot) `Text.append` (fromUrl url params)) url request respond -- | a low-level function for convert a parser, printer, and routing function into an 'Application' --@@ -40,7 +40,7 @@ handleWaiError fromUrl toUrl approot handleError handler where handleError :: String -> Application- handleError parseError = \_request -> return $ responseLBS status404 [] (L.pack parseError)+ handleError parseError _request respond = respond $ responseLBS status404 [] (L.pack parseError) -- | function to convert a routing function into an Application by -- leveraging 'PathInfo' to do the url conversion@@ -53,13 +53,13 @@ -- | a function to convert a parser, printer and routing function into an 'Application'. -- -- This is similar to 'handleWai_' expect that it expects the routing function to use 'RouteT'.-handleWaiRouteT_ :: (url -> [(Text, Maybe Text)] -> Text) -- ^ function to convert a 'url' + params into path info + query string- -> (S.ByteString -> Either String url) -- ^ function to parse path info into 'url'- -> S.ByteString -- ^ app root+handleWaiRouteT_ :: (url -> [(Text, Maybe Text)] -> Text) -- ^ function to convert a 'url' + params into path info + query string+ -> (S.ByteString -> Either String url) -- ^ function to parse path info into 'url'+ -> S.ByteString -- ^ app root -> (url -> Request -> RouteT url IO Response) -- ^ routing function -> Application-handleWaiRouteT_ toPathInfo fromPathInfo approot handler =- handleWai_ toPathInfo fromPathInfo approot (\toPathInfo' url request -> unRouteT (handler url request) toPathInfo')+handleWaiRouteT_ toPathInfo fromPathInfo approot handler = \request respond ->+ handleWai_ toPathInfo fromPathInfo approot (\toPathInfo' url request respond -> respond =<< unRouteT (handler url request) toPathInfo') request respond -- | convert a 'RouteT' based routing function into an 'Application' using 'PathInfo' to do the url conversion handleWaiRouteT :: (PathInfo url) =>
web-routes-wai.cabal view
@@ -1,5 +1,5 @@ Name: web-routes-wai-Version: 0.23.2+Version: 0.24.0 License: BSD3 License-File: LICENSE Author: jeremy@seereason.com@@ -16,7 +16,7 @@ bytestring >= 0.9 && < 0.11, http-types >= 0.6 && < 0.9, text >= 0.11 && < 1.2,- wai >= 2.0 && < 2.2,+ wai >= 3.0 && < 3.1, web-routes >= 0.27 && < 0.28 Exposed-Modules: Web.Routes.Wai