@@ -13,6 +13,7 @@
13module Servant.Client
13module Servant.Client
15 , HasClient(..)
15 , HasClient(..)
16 , ServantError(..)
17 , ServantError(..)
17 , module Servant.Common.BaseUrl
18 , module Servant.Common.BaseUrl
@@ -130,7 +131,7 @@ instance (MimeUnrender ct result) => HasClient (Get (ct ': cts) result) where
130-- | If you have a 'Get xs ()' endpoint, the client expects a 204 No Content
131-- | If you have a 'Get xs ()' endpoint, the client expects a 204 No Content
131-- HTTP header.
132-- HTTP header.
132instance HasClient (Get (ct ': cts) ()) where
133instance HasClient (Get (ct ': cts) ()) where
133− type Client (Get (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
134+ type Client' (Get (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
134 clientWithRoute Proxy req host =
135 clientWithRoute Proxy req host =
135 performRequestNoBody H.methodGet req [204] host
136 performRequestNoBody H.methodGet req [204] host
@@ -167,7 +168,7 @@ instance (KnownSymbol sym, ToText a, HasClient sublayout)
168 clientWithRoute Proxy req mval =
169 clientWithRoute Proxy req mval =
169 clientWithRoute (Proxy :: Proxy sublayout) $
170 clientWithRoute (Proxy :: Proxy sublayout) $
170− maybe req (\value -> addHeader hname value req) mval
171+ maybe req (\value -> Servant.Common.Req.addHeader hname value req) mval
172 where hname = symbolVal (Proxy :: Proxy sym)
173 where hname = symbolVal (Proxy :: Proxy sym)
@@ -184,7 +185,7 @@ instance (MimeUnrender ct a) => HasClient (Post (ct ': cts) a) where
184-- | If you have a 'Post xs ()' endpoint, the client expects a 204 No Content
185-- | If you have a 'Post xs ()' endpoint, the client expects a 204 No Content
185-- HTTP header.
186-- HTTP header.
186instance HasClient (Post (ct ': cts) ()) where
187instance HasClient (Post (ct ': cts) ()) where
187− type Client (Post (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
188+ type Client' (Post (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
188 clientWithRoute Proxy req host =
189 clientWithRoute Proxy req host =
189 void $ performRequestNoBody H.methodPost req [204] host
190 void $ performRequestNoBody H.methodPost req [204] host
@@ -201,7 +202,7 @@ instance (MimeUnrender ct a) => HasClient (Put (ct ': cts) a) where
201-- | If you have a 'Put xs ()' endpoint, the client expects a 204 No Content
202-- | If you have a 'Put xs ()' endpoint, the client expects a 204 No Content
202-- HTTP header.
203-- HTTP header.
203instance HasClient (Put (ct ': cts) ()) where
204instance HasClient (Put (ct ': cts) ()) where
204− type Client (Put (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
205+ type Client' (Put (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
205 clientWithRoute Proxy req host =
206 clientWithRoute Proxy req host =
206 void $ performRequestNoBody H.methodPut req [204] host
207 void $ performRequestNoBody H.methodPut req [204] host
@@ -210,7 +211,7 @@ instance HasClient (Put (ct ': cts) ()) where
210-- will just require an argument that specifies the scheme, host
211-- will just require an argument that specifies the scheme, host
211-- and port to send the request to.
212-- and port to send the request to.
212instance (MimeUnrender ct a) => HasClient (Patch (ct ': cts) a) where
213instance (MimeUnrender ct a) => HasClient (Patch (ct ': cts) a) where
213− type Client (Patch (ct ': cts) a) = BaseUrl -> EitherT ServantError IO a
214+ type Client' (Patch (ct ': cts) a) = BaseUrl -> EitherT ServantError IO a
215 clientWithRoute Proxy req host =
216 clientWithRoute Proxy req host =
216 performRequestCT (Proxy :: Proxy ct) H.methodPatch req [200,201] host
217 performRequestCT (Proxy :: Proxy ct) H.methodPatch req [200,201] host
@@ -218,7 +219,7 @@ instance (MimeUnrender ct a) => HasClient (Patch (ct ': cts) a) where
218-- | If you have a 'Patch xs ()' endpoint, the client expects a 204 No Content
219-- | If you have a 'Patch xs ()' endpoint, the client expects a 204 No Content
219-- HTTP header.
220-- HTTP header.
220instance HasClient (Patch (ct ': cts) ()) where
221instance HasClient (Patch (ct ': cts) ()) where
221− type Client (Patch (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
222+ type Client' (Patch (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
222 clientWithRoute Proxy req host =
223 clientWithRoute Proxy req host =
223 void $ performRequestNoBody H.methodPatch req [204] host
224 void $ performRequestNoBody H.methodPatch req [204] host
@@ -489,7 +490,7 @@ instance (MimeRender ct a, HasClient sublayout)
489 clientWithRoute Proxy req body =
490 clientWithRoute Proxy req body =
490 clientWithRoute (Proxy :: Proxy sublayout) $ do
491 clientWithRoute (Proxy :: Proxy sublayout) $ do
491 let ctProxy = Proxy :: Proxy ct
492 let ctProxy = Proxy :: Proxy ct
492− setRQBody (toByteString ctProxy body) (contentType ctProxy) req
493+ setRQBody (mimeRender ctProxy body) (contentType ctProxy) req
494-- | Make the querying function append @path@ to the request path.
495-- | Make the querying function append @path@ to the request path.
495instance (KnownSymbol path, HasClient sublayout) => HasClient (path :> sublayout) where
496instance (KnownSymbol path, HasClient sublayout) => HasClient (path :> sublayout) where