~ubuntu-branches/ubuntu/utopic/haskell-wai-extra/utopic-proposed

« back to all changes in this revision

Viewing changes to Network/Wai/Middleware/Rewrite.hs

  • Committer: Package Import Robot
  • Author(s): Clint Adams
  • Date: 2014-06-06 11:40:45 UTC
  • mfrom: (15.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140606114045-cc7h7xuui844a1l0
Tags: 3.0.0-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
-- | rewrite based on your own conversion rules
15
15
rewrite :: ([Text] -> H.RequestHeaders -> IO [Text]) -> Middleware
16
 
rewrite convert app req = do
 
16
rewrite convert app req sendResponse = do
17
17
  newPathInfo <- liftIO $ convert (pathInfo req) (requestHeaders req)
18
18
  let rawPInfo = TE.encodeUtf8 $ T.intercalate "/" newPathInfo
19
 
  app req { pathInfo = newPathInfo, rawPathInfo =  rawPInfo }
 
19
  app req { pathInfo = newPathInfo, rawPathInfo =  rawPInfo } sendResponse
20
20
 
21
21
-- | rewrite based on your own conversion rules
22
22
-- Example convert function: