git.iko.soy/typeable/servant
on master help sign in
Merge pull request #1035 from afcady/multipart-foreign
80a047dOleg Grenrus
servant-foreign/src/Servant/Foreign.hs+2
@@ -5,6 +5,7 @@ module Servant.Foreign
5 , HeaderArg(..)
5 , HeaderArg(..)
6 , QueryArg(..)
6 , QueryArg(..)
7 , Req(..)
7 , Req(..)
8+ , ReqBodyContentType(..)
8 , Segment(..)
9 , Segment(..)
9 , SegmentType(..)
10 , SegmentType(..)
10 , Url(..)
11 , Url(..)
@@ -21,6 +22,7 @@ module Servant.Foreign
21 , reqMethod
22 , reqMethod
22 , reqHeaders
23 , reqHeaders
23 , reqBody
24 , reqBody
25+ , reqBodyContentType
24 , reqReturnType
26 , reqReturnType
25 , reqFuncName
27 , reqFuncName
26 , path
28 , path
servant-foreign/src/Servant/Foreign/Internal.hs+11−7
@@ -123,20 +123,24 @@ defUrl = Url [] []
123
123
124makeLenses ''Url
124makeLenses ''Url
125
125
126+data ReqBodyContentType = ReqBodyJSON | ReqBodyMultipart
127+ deriving (Data, Eq, Show, Read)
128+
126data Req f = Req
129data Req f = Req
127− { _reqUrl :: Url f
130+ { _reqUrl :: Url f
128− , _reqMethod :: HTTP.Method
131+ , _reqMethod :: HTTP.Method
129− , _reqHeaders :: [HeaderArg f]
132+ , _reqHeaders :: [HeaderArg f]
130− , _reqBody :: Maybe f
133+ , _reqBody :: Maybe f
131− , _reqReturnType :: Maybe f
134+ , _reqReturnType :: Maybe f
132− , _reqFuncName :: FunctionName
135+ , _reqFuncName :: FunctionName
136+ , _reqBodyContentType :: ReqBodyContentType
133 }
137 }
134 deriving (Data, Eq, Show, Typeable)
138 deriving (Data, Eq, Show, Typeable)
135
139
136makeLenses ''Req
140makeLenses ''Req
137
141
138defReq :: Req ftype
142defReq :: Req ftype
139−defReq = Req defUrl "GET" [] Nothing Nothing (FunctionName [])
143+defReq = Req defUrl "GET" [] Nothing Nothing (FunctionName []) ReqBodyJSON
140
144
141-- | 'HasForeignType' maps Haskell types with types in the target
145-- | 'HasForeignType' maps Haskell types with types in the target
142-- language of your backend. For example, let's say you're
146-- language of your backend. For example, let's say you're