Add record to Req type

This is needed for servant-js to know whether to call JSON.stringify()
on the request body or just send it raw.
This commit is contained in:
Andrew Cady 2018-09-16 19:12:25 -04:00
parent af7ba3d6b8
commit 62def38a9b
3 changed files with 4 additions and 2 deletions

View file

@ -1,5 +1,5 @@
name: servant-foreign name: servant-foreign
version: 0.11.1 version: 0.11.2
x-revision: 3 x-revision: 3
synopsis: Helpers for generating clients for servant APIs in any programming language synopsis: Helpers for generating clients for servant APIs in any programming language
description: description:

View file

@ -21,6 +21,7 @@ module Servant.Foreign
, reqMethod , reqMethod
, reqHeaders , reqHeaders
, reqBody , reqBody
, reqBodyIsJSON
, reqReturnType , reqReturnType
, reqFuncName , reqFuncName
, path , path

View file

@ -130,13 +130,14 @@ data Req f = Req
, _reqBody :: Maybe f , _reqBody :: Maybe f
, _reqReturnType :: Maybe f , _reqReturnType :: Maybe f
, _reqFuncName :: FunctionName , _reqFuncName :: FunctionName
, _reqBodyIsJSON :: Bool
} }
deriving (Data, Eq, Show, Typeable) deriving (Data, Eq, Show, Typeable)
makeLenses ''Req makeLenses ''Req
defReq :: Req ftype defReq :: Req ftype
defReq = Req defUrl "GET" [] Nothing Nothing (FunctionName []) defReq = Req defUrl "GET" [] Nothing Nothing (FunctionName []) True
-- | 'HasForeignType' maps Haskell types with types in the target -- | 'HasForeignType' maps Haskell types with types in the target
-- language of your backend. For example, let's say you're -- language of your backend. For example, let's say you're