on master help sign in
RequestMethod -> Method
commit31a70e8c2c1949d234c47a18c93bfa189eb33e02 authorMichael Snoyman <michael@snoyman.com> dateSat 23 Jan 2010, 21:21 (17 years ago) parentbf9c588
1 file changed+9−9
Network/Wai.hs+9−9
Network/Wai.hs+9−9
@@ -2,7 +2,7 @@
22module Network.Wai
33 ( -- * Data types
44 -- ** Request method
5− RequestMethod (..)
5+ Method (..)
66 , methodFromBS
77 , methodToBS
88 -- ** URL scheme (http versus https)
@@ -29,7 +29,7 @@ import Control.Monad (unless)
2929-- | Please do not use the Show and Read instances for anything other than
3030-- debugging purposes. Instead, the 'methodFromBS' and 'methodToBS' provide a
3131-- more appropriate interface.
32−data RequestMethod =
32+data Method =
3333 OPTIONS
3434 | GET
3535 | HEAD
@@ -38,10 +38,10 @@ data RequestMethod =
3838 | DELETE
3939 | TRACE
4040 | CONNECT
41− | OtherMethod B.ByteString
41+ | Method B.ByteString
4242 deriving (Show, Read, Eq)
4343
44−methodFromBS :: B.ByteString -> RequestMethod
44+methodFromBS :: B.ByteString -> Method
4545methodFromBS bs
4646 | B.length bs <= 7 = case B8.unpack bs of
4747 "OPTIONS" -> OPTIONS
@@ -52,10 +52,10 @@ methodFromBS bs
5252 "DELETE" -> DELETE
5353 "TRACE" -> TRACE
5454 "CONNECT" -> CONNECT
55− _ -> OtherMethod bs
56− | otherwise = OtherMethod bs
55+ _ -> Method bs
56+ | otherwise = Method bs
5757
58−methodToBS :: RequestMethod -> B.ByteString
58+methodToBS :: Method -> B.ByteString
5959methodToBS OPTIONS = B8.pack "OPTIONS"
6060methodToBS GET = B8.pack "GET"
6161methodToBS HEAD = B8.pack "HEAD"
@@ -64,7 +64,7 @@ methodToBS PUT = B8.pack "PUT"
6464methodToBS DELETE = B8.pack "DELETE"
6565methodToBS TRACE = B8.pack "TRACE"
6666methodToBS CONNECT = B8.pack "CONNECT"
67−methodToBS (OtherMethod bs) = bs
67+methodToBS (Method bs) = bs
6868
6969data UrlScheme = HTTP | HTTPS deriving (Show, Eq)
7070
@@ -91,7 +91,7 @@ httpVersionToBS Http11 = B8.pack "1.1"
9191httpVersionToBS (HttpVersion bs) = bs
9292
9393data Request = Request
94− { requestMethod :: RequestMethod
94+ { requestMethod :: Method
9595 , httpVersion :: HttpVersion
9696 , pathInfo :: B.ByteString
9797 , queryString :: B.ByteString