@@ -22,8 +22,10 @@ import Network.Socket (SockAddr)
23-- | Information on the request sent by the client. This abstracts away the
23-- | Information on the request sent by the client. This abstracts away the
24-- details of the underlying implementation.
24-- details of the underlying implementation.
25−data Request = Request
25+data Request = Request {
26+ -- | Request method such as GET.
26− { requestMethod :: H.Method
27+ requestMethod :: H.Method
28+ -- | HTTP version such as 1.1.
27 , httpVersion :: H.HttpVersion
29 , httpVersion :: H.HttpVersion
28 -- | Extra path information sent by the client. The meaning varies slightly
30 -- | Extra path information sent by the client. The meaning varies slightly
29 -- depending on backend; in a standalone server setting, this is most likely
31 -- depending on backend; in a standalone server setting, this is most likely
@@ -35,6 +37,7 @@ data Request = Request
35 -- /will/ include the leading question mark.
37 -- /will/ include the leading question mark.
36 -- Do not modify this raw value- modify queryString instead.
38 -- Do not modify this raw value- modify queryString instead.
37 , rawQueryString :: B.ByteString
39 , rawQueryString :: B.ByteString
40+ -- | A list of header (a pair of key and value) in an HTTP request.
38 , requestHeaders :: H.RequestHeaders
41 , requestHeaders :: H.RequestHeaders
39 -- | Was this request made over an SSL connection?
42 -- | Was this request made over an SSL connection?
@@ -51,6 +54,7 @@ data Request = Request
51 , pathInfo :: [Text]
54 , pathInfo :: [Text]
52 -- | Parsed query string information
55 -- | Parsed query string information
53 , queryString :: H.Query
56 , queryString :: H.Query
57+ -- | A request body provided as 'Source'.
54 , requestBody :: C.Source IO B.ByteString
58 , requestBody :: C.Source IO B.ByteString
55 -- | A location for arbitrary data to be shared by applications and middleware.
59 -- | A location for arbitrary data to be shared by applications and middleware.
56 , vault :: Vault
60 , vault :: Vault
@@ -59,8 +63,12 @@ data Request = Request
59 -- Since 1.4.0
63 -- Since 1.4.0
60 , requestBodyLength :: RequestBodyLength
64 , requestBodyLength :: RequestBodyLength
61 -- | The value of the Host header in a HTTP request.
65 -- | The value of the Host header in a HTTP request.
62 , requestHeaderHost :: Maybe B.ByteString
68 , requestHeaderHost :: Maybe B.ByteString
63 -- | The value of the Range header in a HTTP request.
69 -- | The value of the Range header in a HTTP request.
64 , requestHeaderRange :: Maybe B.ByteString
72 , requestHeaderRange :: Maybe B.ByteString
66 deriving (Typeable)
74 deriving (Typeable)
@@ -81,6 +89,7 @@ data Response
81 | ResponseSource H.Status H.ResponseHeaders (forall b. WithSource IO (C.Flush Builder) b)
89 | ResponseSource H.Status H.ResponseHeaders (forall b. WithSource IO (C.Flush Builder) b)
82 deriving Typeable
90 deriving Typeable
92+-- | Auxiliary type for 'ResponseSource'.
84type WithSource m a b = (C.Source m a -> m b) -> m b
93type WithSource m a b = (C.Source m a -> m b) -> m b
86-- | The size of the request body. In the case of chunked bodies, the size will
95-- | The size of the request body. In the case of chunked bodies, the size will