@@ -2,7 +2,7 @@
2module Network.Wai
2module Network.Wai
3 ( -- * Data types
3 ( -- * Data types
4 -- ** Request method
4 -- ** Request method
5− RequestMethod (..)
5+ Method (..)
6 , methodFromBS
6 , methodFromBS
7 , methodToBS
7 , methodToBS
8 -- ** URL scheme (http versus https)
8 -- ** URL scheme (http versus https)
@@ -29,7 +29,7 @@ import Control.Monad (unless)
29-- | Please do not use the Show and Read instances for anything other than
29-- | Please do not use the Show and Read instances for anything other than
30-- debugging purposes. Instead, the 'methodFromBS' and 'methodToBS' provide a
30-- debugging purposes. Instead, the 'methodFromBS' and 'methodToBS' provide a
31-- more appropriate interface.
31-- more appropriate interface.
32−data RequestMethod =
32+data Method =
@@ -38,10 +38,10 @@ data RequestMethod =
41− | OtherMethod B.ByteString
41+ | Method B.ByteString
42 deriving (Show, Read, Eq)
42 deriving (Show, Read, Eq)
44−methodFromBS :: B.ByteString -> RequestMethod
44+methodFromBS :: B.ByteString -> Method
45methodFromBS bs
45methodFromBS bs
46 | B.length bs <= 7 = case B8.unpack bs of
46 | B.length bs <= 7 = case B8.unpack bs of
47 "OPTIONS" -> OPTIONS
47 "OPTIONS" -> OPTIONS
@@ -52,10 +52,10 @@ methodFromBS bs
52 "DELETE" -> DELETE
52 "DELETE" -> DELETE
53 "TRACE" -> TRACE
53 "TRACE" -> TRACE
54 "CONNECT" -> CONNECT
54 "CONNECT" -> CONNECT
55− _ -> OtherMethod bs
55+ _ -> Method bs
56− | otherwise = OtherMethod bs
56+ | otherwise = Method bs
58−methodToBS :: RequestMethod -> B.ByteString
58+methodToBS :: Method -> B.ByteString
59methodToBS OPTIONS = B8.pack "OPTIONS"
59methodToBS OPTIONS = B8.pack "OPTIONS"
60methodToBS GET = B8.pack "GET"
60methodToBS GET = B8.pack "GET"
61methodToBS HEAD = B8.pack "HEAD"
61methodToBS HEAD = B8.pack "HEAD"
@@ -64,7 +64,7 @@ methodToBS PUT = B8.pack "PUT"
64methodToBS DELETE = B8.pack "DELETE"
64methodToBS DELETE = B8.pack "DELETE"
65methodToBS TRACE = B8.pack "TRACE"
65methodToBS TRACE = B8.pack "TRACE"
66methodToBS CONNECT = B8.pack "CONNECT"
66methodToBS CONNECT = B8.pack "CONNECT"
67−methodToBS (OtherMethod bs) = bs
67+methodToBS (Method bs) = bs
69data UrlScheme = HTTP | HTTPS deriving (Show, Eq)
69data UrlScheme = HTTP | HTTPS deriving (Show, Eq)
@@ -91,7 +91,7 @@ httpVersionToBS Http11 = B8.pack "1.1"
91httpVersionToBS (HttpVersion bs) = bs
91httpVersionToBS (HttpVersion bs) = bs
93data Request = Request
93data Request = Request
94− { requestMethod :: RequestMethod
94+ { requestMethod :: Method
95 , httpVersion :: HttpVersion
95 , httpVersion :: HttpVersion
96 , pathInfo :: B.ByteString
96 , pathInfo :: B.ByteString
97 , queryString :: B.ByteString
97 , queryString :: B.ByteString