@@ -17,6 +17,7 @@ import Data.List (intercalate)
1717
1818-- | Information on the request sent by the client. This abstracts away the
1919-- 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." #-}
2021data Request = Request {
2122 -- | Request method such as GET.
2223 requestMethod :: H.Method
@@ -62,7 +63,7 @@ data Request = Request {
6263 -- | Parsed query string information.
6364 , queryString :: H.Query
6465 -- | 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'.
6667 , requestBody :: IO B.ByteString
6768 -- | A location for arbitrary data to be shared by applications and middleware.
6869 , vault :: Vault
@@ -90,6 +91,13 @@ data Request = Request {
9091 }
9192 deriving (Typeable)
9293
94+-- | Get the next chunk of the body. Returns 'B.empty' when the
95+-- body is fully consumed.
96+--
97+-- @since 3.2.2
98+getRequestBodyChunk :: Request -> IO B.ByteString
99+getRequestBodyChunk = requestBody
100+
93101instance Show Request where
94102 show Request{..} = "Request {" ++ intercalate ", " [a ++ " = " ++ b | (a,b) <- fields] ++ "}"
95103 where