@@ -9,6 +9,7 @@ You want a minimal example? Here it is!
10 {-# LANGUAGE OverloadedStrings #-}
10 {-# LANGUAGE OverloadedStrings #-}
11 import Network.Wai
11 import Network.Wai
12+ import Network.HTTP.Types
12 import Network.Wai.Handler.Warp (run)
13 import Network.Wai.Handler.Warp (run)
13 import Data.ByteString.Lazy.Char8 () -- Just for an orphan instance
14 import Data.ByteString.Lazy.Char8 () -- Just for an orphan instance
@@ -52,6 +53,7 @@ Now we redefine `responseBody` to refer to that file:
53 [("Content-Type", "text/html")]
54 [("Content-Type", "text/html")]
54 "index.html"
55 "index.html"
57Basic dispatching
59Basic dispatching
@@ -65,7 +67,7 @@ An `Application` maps `Request`s to `Response`s:
65Depending on the path info provided with each `Request` we can serve different `Response`s:
67Depending on the path info provided with each `Request` we can serve different `Response`s:
67 app3 :: Application
69 app3 :: Application
68− app3 request = case pathInfo request of
70+ app3 request = case rawPathInfo request of
69 "/" -> return index
71 "/" -> return index
70 "/raw/" -> return plainIndex
72 "/raw/" -> return plainIndex
71 _ -> return notFound
73 _ -> return notFound
@@ -74,6 +76,7 @@ Depending on the path info provided with each `Request` we can serve different `
75 [("Content-Type", "text/plain")]
77 [("Content-Type", "text/plain")]
76 "index.html"
78 "index.html"
78 notFound = responseLBS
81 notFound = responseLBS