@@ -34,6 +34,8 @@ import Data.Bifunctor
34import Data.Bitraversable
34import Data.Bitraversable
35 (Bitraversable (..), bifoldMapDefault, bimapDefault)
35 (Bitraversable (..), bifoldMapDefault, bimapDefault)
36import qualified Data.ByteString as BS
36import qualified Data.ByteString as BS
37+import Data.ByteString.Builder
37import qualified Data.ByteString.Builder as Builder
39import qualified Data.ByteString.Builder as Builder
38import qualified Data.ByteString.Lazy as LBS
40import qualified Data.ByteString.Lazy as LBS
39import qualified Data.Sequence as Seq
41import qualified Data.Sequence as Seq
@@ -112,7 +114,7 @@ instance (NFData path, NFData body) => NFData (RequestF body path) where
112 rnfB Nothing = ()
114 rnfB Nothing = ()
113 rnfB (Just (b, mt)) = rnf b `seq` mediaTypeRnf mt
115 rnfB (Just (b, mt)) = rnf b `seq` mediaTypeRnf mt
115−type Request = RequestF RequestBody Builder.Builder
117+type Request = RequestF RequestBody Builder
117-- | The request body. R replica of the @http-client@ @RequestBody@.
119-- | The request body. R replica of the @http-client@ @RequestBody@.
118data RequestBody
120data RequestBody
@@ -145,9 +147,10 @@ defaultRequest = Request
146-- | Append extra path to the request being constructed.
148-- | Append extra path to the request being constructed.
150+-- Warning: This function assumes that the path fragment is already URL-encoded.
148−appendToPath :: Text -> Request -> Request
151+appendToPath :: Builder -> Request -> Request
149appendToPath p req
152appendToPath p req
150− = req { requestPath = requestPath req <> "/" <> toEncodedUrlPiece p }
153+ = req { requestPath = requestPath req <> "/" <> p }
152-- | Append a query parameter to the request being constructed.
155-- | Append a query parameter to the request being constructed.