File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
servant-client-core/src/Servant/Client/Core Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,31 @@ instance {-# OVERLAPPABLE #-}
297
297
, requestMethod = reflectMethod (Proxy :: Proxy method )
298
298
}
299
299
300
+ instance {-# OVERLAPPING #-}
301
+ ( RunStreamingClient m , MimeUnrender ct chunk , ReflectMethod method ,
302
+ FramingUnrender framing , FromSourceIO chunk a ,
303
+ BuildHeadersTo hs
304
+ ) => HasClient m (Stream method status framing ct (Headers hs a )) where
305
+
306
+ type Client m (Stream method status framing ct (Headers hs a )) = m (Headers hs a )
307
+
308
+ hoistClientMonad _ _ f ma = f ma
309
+
310
+ clientWithRoute _pm Proxy req = withStreamingRequest req' $ \ gres -> do
311
+ let mimeUnrender' = mimeUnrender (Proxy :: Proxy ct ) :: BL. ByteString -> Either String chunk
312
+ framingUnrender' = framingUnrender (Proxy :: Proxy framing ) mimeUnrender'
313
+ val = fromSourceIO $ framingUnrender' $ responseBody gres
314
+ return $ Headers
315
+ { getResponse = val
316
+ , getHeadersHList = buildHeadersTo . toList $ responseHeaders gres
317
+ }
318
+
319
+ where
320
+ req' = req
321
+ { requestAccept = fromList [contentType (Proxy :: Proxy ct )]
322
+ , requestMethod = reflectMethod (Proxy :: Proxy method )
323
+ }
324
+
300
325
-- | If you use a 'Header' in one of your endpoints in your API,
301
326
-- the corresponding querying function will automatically take
302
327
-- an additional argument of the type specified by your 'Header',
You can’t perform that action at this time.
0 commit comments