on master help sign in
Fixed README
1b99c31Michael Snoyman
README.lhs+4−1
@@ -8,6 +8,7 @@ You want a minimal example? Here it is!
8
8
9> {-# LANGUAGE OverloadedStrings #-}
9> {-# LANGUAGE OverloadedStrings #-}
10> import Network.Wai
10> import Network.Wai
11+> import Network.HTTP.Types
11> import Network.Wai.Handler.Warp (run)
12> import Network.Wai.Handler.Warp (run)
12> import Data.ByteString.Lazy.Char8 () -- Just for an orphan instance
13> import Data.ByteString.Lazy.Char8 () -- Just for an orphan instance
13>
14>
@@ -53,6 +54,7 @@ Now we redefine `responseBody` to refer to that file:
53> status200
54> status200
54> [("Content-Type", "text/html")]
55> [("Content-Type", "text/html")]
55> "index.html"
56> "index.html"
57+> Nothing
56
58
57
59
58Basic dispatching
60Basic dispatching
@@ -67,7 +69,7 @@ Depending on the path info provided with each `Request` we can serve
67different `Response`s:
69different `Response`s:
68
70
69> app3 :: Application
71> app3 :: Application
70−> app3 request = case pathInfo request of
72+> app3 request = case rawPathInfo request of
71> "/" -> return index
73> "/" -> return index
72> "/raw/" -> return plainIndex
74> "/raw/" -> return plainIndex
73> _ -> return notFound
75> _ -> return notFound
@@ -76,6 +78,7 @@ different `Response`s:
76> status200
78> status200
77> [("Content-Type", "text/plain")]
79> [("Content-Type", "text/plain")]
78> "index.html"
80> "index.html"
81+> Nothing
79>
82>
80> notFound = responseLBS
83> notFound = responseLBS
81> status404
84> status404
README.md+4−1
@@ -9,6 +9,7 @@ You want a minimal example? Here it is!
9
9
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
14
15
@@ -52,6 +53,7 @@ Now we redefine `responseBody` to refer to that file:
52 status200
53 status200
53 [("Content-Type", "text/html")]
54 [("Content-Type", "text/html")]
54 "index.html"
55 "index.html"
56+ Nothing
55
57
56
58
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:
66
68
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 `
74 status200
76 status200
75 [("Content-Type", "text/plain")]
77 [("Content-Type", "text/plain")]
76 "index.html"
78 "index.html"
79+ Nothing
77
80
78 notFound = responseLBS
81 notFound = responseLBS
79 status404
82 status404