client: Parameterize RequestF on request body type
This allows us to provide an NFData instance for RequestF, which will later be useful when we capture the request in FailureResponse.
This commit is contained in:
parent
109f7b2a45
commit
aa704596be
2 changed files with 21 additions and 4 deletions
|
@ -1,6 +1,13 @@
|
|||
[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-client-core/CHANGELOG.md)
|
||||
[Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md)
|
||||
|
||||
0.15.1
|
||||
------
|
||||
|
||||
- `RequestF` is now parametrized on the request body type as well as the path
|
||||
type.
|
||||
|
||||
|
||||
0.15
|
||||
----
|
||||
|
||||
|
|
|
@ -75,17 +75,27 @@ instance NFData ServantError where
|
|||
rnf (InvalidContentTypeHeader res) = rnf res
|
||||
rnf (ConnectionError err) = rnf err
|
||||
|
||||
data RequestF a = Request
|
||||
{ requestPath :: a
|
||||
data RequestF body path = Request
|
||||
{ requestPath :: path
|
||||
, requestQueryString :: Seq.Seq QueryItem
|
||||
, requestBody :: Maybe (RequestBody, MediaType)
|
||||
, requestBody :: Maybe (body, MediaType)
|
||||
, requestAccept :: Seq.Seq MediaType
|
||||
, requestHeaders :: Seq.Seq Header
|
||||
, requestHttpVersion :: HttpVersion
|
||||
, requestMethod :: Method
|
||||
} deriving (Generic, Typeable)
|
||||
|
||||
type Request = RequestF Builder.Builder
|
||||
instance (NFData path, NFData body) => NFData (Request body path) where
|
||||
rnf r =
|
||||
rnf (requestPath r)
|
||||
`seq` rnf (requestQueryString r)
|
||||
`seq` rnf (requestBody r)
|
||||
`seq` rnf (requestAccept r)
|
||||
`seq` rnf (requestHeaders r)
|
||||
`seq` rnf (requestHttpVersion r)
|
||||
`seq` rnf (requestMethod r)
|
||||
|
||||
type Request = RequestF RequestBody Builder.Builder
|
||||
|
||||
-- | The request body. A replica of the @http-client@ @RequestBody@.
|
||||
data RequestBody
|
||||
|
|
Loading…
Reference in a new issue