@@ -17,6 +17,7 @@ import Data.List (intercalate)
18-- | Information on the request sent by the client. This abstracts away the
18-- | Information on the request sent by the client. This abstracts away the
19-- details of the underlying implementation.
19-- details of the underlying implementation.
20+{-# DEPRECATED requestBody "requestBody's name is misleading because it only gets a partial chunk of the body. Use getRequestBodyChunk instead." #-}
20data Request = Request {
21data Request = Request {
21 -- | Request method such as GET.
22 -- | Request method such as GET.
22 requestMethod :: H.Method
23 requestMethod :: H.Method
@@ -62,7 +63,7 @@ data Request = Request {
62 -- | Parsed query string information.
63 -- | Parsed query string information.
63 , queryString :: H.Query
64 , queryString :: H.Query
64 -- | Get the next chunk of the body. Returns 'B.empty' when the
65 -- | Get the next chunk of the body. Returns 'B.empty' when the
65− -- body is fully consumed.
66+ -- body is fully consumed. Since 3.2.2, this is deprecated in favor of 'getRequestBodyChunk'.
66 , requestBody :: IO B.ByteString
67 , requestBody :: IO B.ByteString
67 -- | A location for arbitrary data to be shared by applications and middleware.
68 -- | A location for arbitrary data to be shared by applications and middleware.
68 , vault :: Vault
69 , vault :: Vault
@@ -90,6 +91,13 @@ data Request = Request {
91 deriving (Typeable)
92 deriving (Typeable)
94+-- | Get the next chunk of the body. Returns 'B.empty' when the
95+-- body is fully consumed.
98+getRequestBodyChunk :: Request -> IO B.ByteString
99+getRequestBodyChunk = requestBody
93instance Show Request where
101instance Show Request where
94 show Request{..} = "Request {" ++ intercalate ", " [a ++ " = " ++ b | (a,b) <- fields] ++ "}"
102 show Request{..} = "Request {" ++ intercalate ", " [a ++ " = " ++ b | (a,b) <- fields] ++ "}"