|
1 |
| -{-# LANGUAGE CPP #-} |
2 |
| -{-# LANGUAGE DeriveDataTypeable #-} |
3 |
| -{-# LANGUAGE DeriveFunctor #-} |
4 |
| -{-# LANGUAGE DeriveFoldable #-} |
5 |
| -{-# LANGUAGE DeriveTraversable #-} |
6 |
| -{-# LANGUAGE DeriveGeneric #-} |
7 |
| -{-# LANGUAGE MultiParamTypeClasses #-} |
8 |
| -{-# LANGUAGE RankNTypes #-} |
9 |
| -{-# LANGUAGE OverloadedStrings #-} |
10 |
| -{-# LANGUAGE ScopedTypeVariables #-} |
11 |
| -{-# LANGUAGE TypeFamilies #-} |
| 1 | +{-# LANGUAGE CPP #-} |
| 2 | +{-# LANGUAGE DeriveDataTypeable #-} |
| 3 | +{-# LANGUAGE DeriveFoldable #-} |
| 4 | +{-# LANGUAGE DeriveFunctor #-} |
| 5 | +{-# LANGUAGE DeriveGeneric #-} |
| 6 | +{-# LANGUAGE DeriveTraversable #-} |
| 7 | +{-# LANGUAGE MultiParamTypeClasses #-} |
| 8 | +{-# LANGUAGE OverloadedStrings #-} |
| 9 | +{-# LANGUAGE RankNTypes #-} |
| 10 | +{-# LANGUAGE ScopedTypeVariables #-} |
| 11 | +{-# LANGUAGE TypeFamilies #-} |
12 | 12 |
|
13 | 13 | module Servant.Client.Core.Internal.Request where
|
14 | 14 |
|
15 | 15 | import Prelude ()
|
16 | 16 | import Prelude.Compat
|
17 | 17 |
|
18 | 18 | import Control.Monad.Catch (Exception)
|
19 |
| -import qualified Data.ByteString.Builder as Builder |
20 | 19 | import qualified Data.ByteString as BS
|
| 20 | +import qualified Data.ByteString.Builder as Builder |
21 | 21 | import qualified Data.ByteString.Lazy as LBS
|
| 22 | +import Data.Int (Int64) |
22 | 23 | import Data.Semigroup ((<>))
|
23 | 24 | import qualified Data.Sequence as Seq
|
24 | 25 | import Data.Text (Text)
|
@@ -58,13 +59,19 @@ data RequestF a = Request
|
58 | 59 | , requestHeaders :: Seq.Seq Header
|
59 | 60 | , requestHttpVersion :: HttpVersion
|
60 | 61 | , requestMethod :: Method
|
61 |
| - } deriving (Eq, Show, Functor, Generic, Typeable) |
| 62 | + } deriving (Generic, Typeable) |
62 | 63 |
|
63 | 64 | type Request = RequestF Builder.Builder
|
64 | 65 |
|
65 |
| --- | The request body. Currently only lazy ByteStrings are supported. |
66 |
| -newtype RequestBody = RequestBodyLBS LBS.ByteString |
67 |
| - deriving (Eq, Ord, Read, Show, Typeable) |
| 66 | +-- | The request body. A replica of the @http-client@ @RequestBody@. |
| 67 | +data RequestBody |
| 68 | + = RequestBodyLBS LBS.ByteString |
| 69 | + | RequestBodyBS BS.ByteString |
| 70 | + | RequestBodyBuilder Int64 Builder.Builder |
| 71 | + | RequestBodyStream Int64 ((IO BS.ByteString -> IO ()) -> IO ()) |
| 72 | + | RequestBodyStreamChunked ((IO BS.ByteString -> IO ()) -> IO ()) |
| 73 | + | RequestBodyIO (IO RequestBody) |
| 74 | + deriving (Generic, Typeable) |
68 | 75 |
|
69 | 76 | data GenResponse a = Response
|
70 | 77 | { responseStatusCode :: Status
|
|
0 commit comments