@@ -1,9 +1,20 @@
1+{-# LANGUAGE BangPatterns #-}
2+{-# LANGUAGE CPP #-}
13{-# LANGUAGE DataKinds #-}
4+{-# LANGUAGE DeriveDataTypeable #-}
5+{-# LANGUAGE DeriveGeneric #-}
6+{-# LANGUAGE DeriveLift #-}
7+{-# LANGUAGE FlexibleInstances #-}
8+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
29{-# LANGUAGE LambdaCase #-}
10+{-# LANGUAGE MultiParamTypeClasses #-}
311{-# LANGUAGE OverloadedStrings #-}
412{-# LANGUAGE QuasiQuotes #-}
13+{-# LANGUAGE RankNTypes #-}
514{-# LANGUAGE RecordWildCards #-}
615{-# LANGUAGE RoleAnnotations #-}
16+{-# LANGUAGE ScopedTypeVariables #-}
17+{-# LANGUAGE StandaloneDeriving #-}
718{-# LANGUAGE TemplateHaskellQuotes #-}
819{-# LANGUAGE TypeFamilies #-}
920{-# LANGUAGE UndecidableInstances #-}
@@ -144,13 +155,11 @@ module Network.HTTP.Req
144155 -- $query-parameters
145156 (=:),
146157 queryFlag,
147− formToQuery,
148158 QueryParam (..),
149159
150160 -- *** Headers
151161 header,
152162 attachHeader,
153− headerRedacted,
154163
155164 -- *** Cookies
156165 -- $cookies
@@ -197,78 +206,58 @@ module Network.HTTP.Req
197206
198207 -- * Other
199208 HttpException (..),
200− isStatusCodeException,
201209 CanHaveBody (..),
202210 Scheme (..),
203211 )
204212where
205213
206−import Blaze.ByteString.Builder qualified as BB
214+import qualified Blaze.ByteString.Builder as BB
207215import Control.Applicative
208216import Control.Arrow (first, second)
209217import Control.Exception hiding (Handler (..), TypeError)
210−import Control.Monad (guard, void, (>=>))
211218import Control.Monad.Base
212219import Control.Monad.Catch (Handler (..), MonadCatch, MonadMask, MonadThrow)
213220import Control.Monad.IO.Class
214221import Control.Monad.IO.Unlift
215−import Control.Monad.Reader (ReaderT (ReaderT), ask, lift, runReaderT)
216−import Control.Monad.Trans.Accum (AccumT)
217−import Control.Monad.Trans.Cont (ContT)
222+import Control.Monad.Reader
218223import Control.Monad.Trans.Control
219−import Control.Monad.Trans.Except (ExceptT)
220−import Control.Monad.Trans.Identity (IdentityT)
221−import Control.Monad.Trans.Maybe (MaybeT)
222−import Control.Monad.Trans.RWS.CPS qualified as RWS.CPS
223−import Control.Monad.Trans.RWS.Lazy qualified as RWS.Lazy
224−import Control.Monad.Trans.RWS.Strict qualified as RWS.Strict
225−import Control.Monad.Trans.Select (SelectT)
226−import Control.Monad.Trans.State.Lazy qualified as State.Lazy
227−import Control.Monad.Trans.State.Strict qualified as State.Strict
228−import Control.Monad.Trans.Writer.CPS qualified as Writer.CPS
229−import Control.Monad.Trans.Writer.Lazy qualified as Writer.Lazy
230−import Control.Monad.Trans.Writer.Strict qualified as Writer.Strict
231224import Control.Retry
232225import Data.Aeson (FromJSON (..), ToJSON (..))
233−import Data.Aeson qualified as A
226+import qualified Data.Aeson as A
234227import Data.ByteString (ByteString)
235−import Data.ByteString qualified as B
236−import Data.ByteString.Lazy qualified as BL
237−import Data.CaseInsensitive qualified as CI
228+import qualified Data.ByteString as B
229+import qualified Data.ByteString.Lazy as BL
230+import qualified Data.CaseInsensitive as CI
238231import Data.Data (Data)
239−import Data.Default.Class (def)
240232import Data.Function (on)
241233import Data.IORef
242234import Data.Kind (Constraint, Type)
243235import Data.List (foldl', nubBy)
244236import Data.List.NonEmpty (NonEmpty (..))
245−import Data.List.NonEmpty qualified as NE
237+import qualified Data.List.NonEmpty as NE
246238import Data.Maybe (fromMaybe)
247239import Data.Proxy
248−import Data.Semigroup (Endo (..))
249−import Data.Set qualified as S
240+import Data.Semigroup hiding (Option, option)
250241import Data.Text (Text)
251−import Data.Text qualified as T
252−import Data.Text.Encoding qualified as T
242+import qualified Data.Text as T
243+import qualified Data.Text.Encoding as T
253244import Data.Typeable (Typeable, cast)
254245import GHC.Generics
255246import GHC.TypeLits
256−import Language.Haskell.TH qualified as TH
257−import Language.Haskell.TH.Quote qualified as TH
258−import Language.Haskell.TH.Syntax qualified as TH
259−import Network.Connection qualified as NC
260−import Network.HTTP.Client qualified as L
261−import Network.HTTP.Client.Internal qualified as LI
262−import Network.HTTP.Client.MultipartFormData qualified as LM
263−import Network.HTTP.Client.TLS qualified as L
264−import Network.HTTP.Types qualified as Y
247+import qualified Language.Haskell.TH as TH
248+import qualified Language.Haskell.TH.Quote as TH
249+import qualified Language.Haskell.TH.Syntax as TH
250+import qualified Network.Connection as NC
251+import qualified Network.HTTP.Client as L
252+import qualified Network.HTTP.Client.Internal as LI
253+import qualified Network.HTTP.Client.MultipartFormData as LM
254+import qualified Network.HTTP.Client.TLS as L
255+import qualified Network.HTTP.Types as Y
265256import System.IO.Unsafe (unsafePerformIO)
266257import Text.URI (URI)
267−import Text.URI qualified as URI
268−import Text.URI.QQ qualified as QQ
269−import Web.Authenticate.OAuth qualified as OAuth
270−import Web.FormUrlEncoded (FromForm (..), ToForm (..))
271−import Web.FormUrlEncoded qualified as Form
258+import qualified Text.URI as URI
259+import qualified Text.URI.QQ as QQ
260+import qualified Web.Authenticate.OAuth as OAuth
272261import Web.HttpApiData (ToHttpApiData (..))
273262
274263----------------------------------------------------------------------------
@@ -489,7 +478,7 @@ reqCb method url body responseProxy options adjustRequest =
489478--
490479-- @since 3.7.0
491480reqHandler ::
492− (MonadHttp m) =>
481+ MonadHttp m =>
493482 -- | How to get final result from a 'L.Response'
494483 (L.Response L.BodyReader -> IO b) ->
495484 -- | 'L.Request' to perform
@@ -585,10 +574,10 @@ req' method url body options m = do
585574 withReqManager (m request)
586575
587576-- | Perform an action using the global implicit 'L.Manager' that the rest
588−-- of the library uses. This allows us to reuse connections that the
577+-- of the library uses. This allows to reuse connections that the
589578-- 'L.Manager' controls.
590−withReqManager :: (MonadIO m) => (L.Manager -> m a) -> m a
591−withReqManager m = m globalManager
579+withReqManager :: MonadIO m => (L.Manager -> m a) -> m a
580+withReqManager m = liftIO (readIORef globalManager) >>= m
592581
593582-- | The global 'L.Manager' that 'req' uses. Here we just go with the
594583-- default settings, so users don't need to deal with this manager stuff at
@@ -601,16 +590,16 @@ withReqManager m = m globalManager
601590-- manager. From that moment on the 'IORef' will be just reused—exactly the
602591-- behavior we want here in order to maximize connection sharing. GHC could
603592-- spoil the plan by inlining the definition, hence the @NOINLINE@ pragma.
604−globalManager :: L.Manager
593+globalManager :: IORef L.Manager
605594globalManager = unsafePerformIO $ do
606595 context <- NC.initConnectionContext
607596 let settings =
608597 L.mkManagerSettingsContext
609598 (Just context)
610− def
599+ (NC.TLSSettingsSimple False False False)
611600 Nothing
612601 manager <- L.newManager settings
613− return manager
602+ newIORef manager
614603{-# NOINLINE globalManager #-}
615604
616605----------------------------------------------------------------------------
@@ -630,7 +619,7 @@ globalManager = unsafePerformIO $ do
630619-- | A type class for monads that support performing HTTP requests.
631620-- Typically, you only need to define the 'handleHttpException' method
632621-- unless you want to tweak 'HttpConfig'.
633−class (MonadIO m) => MonadHttp m where
622+class MonadIO m => MonadHttp m where
634623 -- | This method describes how to deal with 'HttpException' that was
635624 -- caught by the library. One option is to re-throw it if you are OK with
636625 -- exceptions, but if you prefer working with something like
@@ -714,8 +703,9 @@ data HttpConfig = HttpConfig
714703 -- | Max length of preview fragment of response body.
715704 --
716705 -- @since 3.6.0
717− httpConfigBodyPreviewLength :: forall a. (Num a) => a
706+ httpConfigBodyPreviewLength :: forall a. Num a => a
718707 }
708+ deriving (Typeable)
719709
720710-- | The default value of 'HttpConfig'.
721711--
@@ -797,87 +787,12 @@ instance MonadHttp Req where
797787 handleHttpException = Req . lift . throwIO
798788 getHttpConfig = Req ask
799789
800−-- | @since 3.10.0
801−instance (MonadHttp m, Monoid w) => MonadHttp (AccumT w m) where
802− handleHttpException = lift . handleHttpException
803− getHttpConfig = lift getHttpConfig
804−
805−-- | @since 3.10.0
806−instance (MonadHttp m) => MonadHttp (ContT r m) where
807− handleHttpException = lift . handleHttpException
808− getHttpConfig = lift getHttpConfig
809−
810−-- | @since 3.10.0
811−instance (MonadHttp m) => MonadHttp (ExceptT e m) where
812− handleHttpException = lift . handleHttpException
813− getHttpConfig = lift getHttpConfig
814−
815−-- | @since 3.10.0
816−instance (MonadHttp m) => MonadHttp (IdentityT m) where
817− handleHttpException = lift . handleHttpException
818− getHttpConfig = lift getHttpConfig
819−
820−-- | @since 3.10.0
821−instance (MonadHttp m) => MonadHttp (MaybeT m) where
822− handleHttpException = lift . handleHttpException
823− getHttpConfig = lift getHttpConfig
824−
825−-- | @since 3.10.0
826−instance (MonadHttp m) => MonadHttp (ReaderT r m) where
827− handleHttpException = lift . handleHttpException
828− getHttpConfig = lift getHttpConfig
829−
830−-- | @since 3.10.0
831−instance (MonadHttp m, Monoid w) => MonadHttp (RWS.CPS.RWST r w s m) where
832− handleHttpException = lift . handleHttpException
833− getHttpConfig = lift getHttpConfig
834−
835−-- | @since 3.10.0
836−instance (MonadHttp m, Monoid w) => MonadHttp (RWS.Lazy.RWST r w s m) where
837− handleHttpException = lift . handleHttpException
838− getHttpConfig = lift getHttpConfig
839−
840−-- | @since 3.10.0
841−instance (MonadHttp m, Monoid w) => MonadHttp (RWS.Strict.RWST r w s m) where
842− handleHttpException = lift . handleHttpException
843− getHttpConfig = lift getHttpConfig
844−
845−-- | @since 3.10.0
846−instance (MonadHttp m) => MonadHttp (SelectT r m) where
847− handleHttpException = lift . handleHttpException
848− getHttpConfig = lift getHttpConfig
849−
850−-- | @since 3.10.0
851−instance (MonadHttp m) => MonadHttp (State.Lazy.StateT s m) where
852− handleHttpException = lift . handleHttpException
853− getHttpConfig = lift getHttpConfig
854−
855−-- | @since 3.10.0
856−instance (MonadHttp m) => MonadHttp (State.Strict.StateT s m) where
857− handleHttpException = lift . handleHttpException
858− getHttpConfig = lift getHttpConfig
859−
860−-- | @since 3.10.0
861−instance (MonadHttp m, Monoid w) => MonadHttp (Writer.CPS.WriterT w m) where
862− handleHttpException = lift . handleHttpException
863− getHttpConfig = lift getHttpConfig
864−
865−-- | @since 3.10.0
866−instance (MonadHttp m, Monoid w) => MonadHttp (Writer.Lazy.WriterT w m) where
867− handleHttpException = lift . handleHttpException
868− getHttpConfig = lift getHttpConfig
869−
870−-- | @since 3.10.0
871−instance (MonadHttp m, Monoid w) => MonadHttp (Writer.Strict.WriterT w m) where
872− handleHttpException = lift . handleHttpException
873− getHttpConfig = lift getHttpConfig
874−
875790-- | Run a computation in the 'Req' monad with the given 'HttpConfig'. In
876791-- the case of an exceptional situation an 'HttpException' will be thrown.
877792--
878793-- @since 0.4.0
879794runReq ::
880− (MonadIO m) =>
795+ MonadIO m =>
881796 -- | 'HttpConfig' to use
882797 HttpConfig ->
883798 -- | Computation to run
@@ -982,7 +897,7 @@ class HttpMethod a where
982897 -- | Return name of the method as a 'ByteString'.
983898 httpMethodName :: Proxy a -> ByteString
984899
985−instance (HttpMethod method) => RequestComponent (Tagged "method" method) where
900+instance HttpMethod method => RequestComponent (Tagged "method" method) where
986901 getRequestMod _ = Endo $ \x ->
987902 x {L.method = httpMethodName (Proxy :: Proxy method)}
988903
@@ -1024,20 +939,25 @@ instance (HttpMethod method) => RequestComponent (Tagged "method" method) where
1024939-- > -- https://%D1%8E%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4.%D1%80%D1%84
1025940data Url (scheme :: Scheme) = Url Scheme (NonEmpty Text)
1026941 -- NOTE The second value is the path segments in reversed order.
1027− deriving (Eq, Ord, Show, Data, Generic)
942+ deriving (Eq, Ord, Show, Data, Typeable, Generic)
1028943
1029944type role Url nominal
1030945
1031946-- With template-haskell >=2.15 and text >=1.2.4 Lift can be derived, however
1032947-- the derived lift forgets the type of the scheme.
1033−instance (Typeable scheme) => TH.Lift (Url scheme) where
948+instance Typeable scheme => TH.Lift (Url scheme) where
1034949 lift url =
1035950 TH.dataToExpQ (fmap liftText . cast) url `TH.sigE` case url of
1036951 Url Http _ -> [t|Url 'Http|]
1037952 Url Https _ -> [t|Url 'Https|]
1038953 where
1039954 liftText t = TH.AppE (TH.VarE 'T.pack) <$> TH.lift (T.unpack t)
955+
956+#if MIN_VERSION_template_haskell(2,17,0)
1040957 liftTyped = TH.Code . TH.unsafeTExpCoerce . TH.lift
958+#elif MIN_VERSION_template_haskell(2,16,0)
959+ liftTyped = TH.unsafeTExpCoerce . TH.lift
960+#endif
1041961
1042962-- | Given host name, produce a 'Url' which has “http” as its scheme and
1043963-- empty path. This also sets port to @80@.
@@ -1053,7 +973,7 @@ https = Url Https . pure
1053973-- path segment can be of any type that is an instance of 'ToHttpApiData'.
1054974infixl 5 /~
1055975
1056−(/~) :: (ToHttpApiData a) => Url scheme -> a -> Url scheme
976+(/~) :: ToHttpApiData a => Url scheme -> a -> Url scheme
1057977Url secure path /~ segment = Url secure (NE.cons (toUrlPiece segment) path)
1058978
1059979-- | A type-constrained version of @('/~')@ to remove ambiguity in the cases
@@ -1241,7 +1161,7 @@ instance HttpBody NoReqBody where
12411161-- charset=utf-8\"@ value.
12421162newtype ReqBodyJson a = ReqBodyJson a
12431163
1244−instance (ToJSON a) => HttpBody (ReqBodyJson a) where
1164+instance ToJSON a => HttpBody (ReqBodyJson a) where
12451165 getRequestBody (ReqBodyJson a) = L.RequestBodyLBS (A.encode a)
12461166 getRequestContentType _ = pure "application/json; charset=utf-8"
12471167
@@ -1294,13 +1214,6 @@ newtype FormUrlEncodedParam = FormUrlEncodedParam [(Text, Maybe Text)]
12941214instance QueryParam FormUrlEncodedParam where
12951215 queryParam name mvalue =
12961216 FormUrlEncodedParam [(name, toQueryParam <$> mvalue)]
1297− queryParamToList (FormUrlEncodedParam p) = p
1298−
1299−-- | Use 'formToQuery'.
1300−--
1301−-- @since 3.11.0
1302−instance FromForm FormUrlEncodedParam where
1303− fromForm = Right . formToQuery
13041217
13051218-- | Multipart form data. Please consult the
13061219-- "Network.HTTP.Client.MultipartFormData" module for how to construct
@@ -1340,7 +1253,7 @@ instance HttpBody ReqBodyMultipart where
13401253-- | Create 'ReqBodyMultipart' request body from a collection of 'LM.Part's.
13411254--
13421255-- @since 0.2.0
1343−reqBodyMultipart :: (MonadIO m) => [LM.Part] -> m ReqBodyMultipart
1256+reqBodyMultipart :: MonadIO m => [LM.Part] -> m ReqBodyMultipart
13441257reqBodyMultipart parts = liftIO $ do
13451258 boundary <- LM.webkitBoundary
13461259 body <- LM.renderParts boundary parts
@@ -1380,7 +1293,7 @@ type family
13801293 TypeError
13811294 ('Text "This HTTP method does not allow attaching a request body.")
13821295
1383−instance (HttpBody body) => RequestComponent (Tagged "body" body) where
1296+instance HttpBody body => RequestComponent (Tagged "body" body) where
13841297 getRequestMod (Tagged body) = Endo $ \x ->
13851298 x
13861299 { L.requestBody = getRequestBody body,
@@ -1426,12 +1339,6 @@ instance Monoid (Option scheme) where
14261339 mempty = Option mempty Nothing
14271340 mappend = (<>)
14281341
1429−-- | Use 'formToQuery'.
1430−--
1431−-- @since 3.11.0
1432−instance FromForm (Option scheme) where
1433− fromForm = Right . formToQuery
1434−
14351342-- | A helper to create an 'Option' that modifies only collection of query
14361343-- parameters. This helper is not a part of the public API.
14371344withQueryParams :: (Y.QueryText -> Y.QueryText) -> Option scheme
@@ -1450,7 +1357,7 @@ instance RequestComponent (Option scheme) where
14501357
14511358-- | Finalize given 'L.Request' by applying a finalizer from the given
14521359-- 'Option' (if it has any).
1453−finalizeRequest :: (MonadIO m) => Option scheme -> L.Request -> m L.Request
1360+finalizeRequest :: MonadIO m => Option scheme -> L.Request -> m L.Request
14541361finalizeRequest (Option _ mfinalizer) = liftIO . fromMaybe pure mfinalizer
14551362
14561363----------------------------------------------------------------------------
@@ -1483,27 +1390,9 @@ name =: value = queryParam name (pure value)
14831390-- This operator is defined in terms of 'queryParam':
14841391--
14851392-- > queryFlag name = queryParam name (Nothing :: Maybe ())
1486−queryFlag :: (QueryParam param) => Text -> param
1393+queryFlag :: QueryParam param => Text -> param
14871394queryFlag name = queryParam name (Nothing :: Maybe ())
14881395
1489−-- | Construct query parameters from a 'ToForm' instance. This function
1490−-- produces the same query params as 'Form.urlEncodeAsFormStable'.
1491−--
1492−-- Note that 'Form.Form' doesn't have the concept of parameters with the
1493−-- empty value (i.e. what you can get by @key =: ""@). If the value is
1494−-- empty, it will be encoded as a valueless parameter (i.e. what you can get
1495−-- by @queryFlag key@).
1496−--
1497−-- @since 3.11.0
1498−formToQuery :: (QueryParam param, Monoid param, ToForm f) => f -> param
1499−formToQuery f = mconcat . fmap toParam . Form.toListStable $ toForm f
1500− where
1501− toParam (key, val) =
1502− queryParam key $
1503− if val == ""
1504− then Nothing
1505− else Just val
1506−
15071396-- | A type class for query-parameter-like things. The reason to have an
15081397-- overloaded 'queryParam' is to be able to use it as an 'Option' and as a
15091398-- 'FormUrlEncodedParam' when constructing form URL encoded request bodies.
@@ -1513,17 +1402,11 @@ class QueryParam param where
15131402 -- 'Nothing', it won't be included at all (i.e. you create a flag this
15141403 -- way). It's recommended to use @('=:')@ and 'queryFlag' instead of this
15151404 -- method, because they are easier to read.
1516− queryParam :: (ToHttpApiData a) => Text -> Maybe a -> param
1517−
1518− -- | Get the query parameter names and values set by 'queryParam'.
1519− --
1520− -- @since 3.11.0
1521− queryParamToList :: param -> [(Text, Maybe Text)]
1405+ queryParam :: ToHttpApiData a => Text -> Maybe a -> param
15221406
15231407instance QueryParam (Option scheme) where
15241408 queryParam name mvalue =
15251409 withQueryParams ((:) (name, toQueryParam <$> mvalue))
1526− queryParamToList (Option f _) = fst $ appEndo f ([], L.defaultRequest)
15271410
15281411----------------------------------------------------------------------------
15291412-- Request—Optional parameters—Headers
@@ -1547,14 +1430,6 @@ attachHeader :: ByteString -> ByteString -> L.Request -> L.Request
15471430attachHeader name value x =
15481431 x {L.requestHeaders = (CI.mk name, value) : L.requestHeaders x}
15491432
1550−-- | Same as 'header', but with redacted values on print.
1551−--
1552−-- @since 3.13.0
1553−headerRedacted :: ByteString -> ByteString -> Option scheme
1554−headerRedacted name value = withRequest $ \x ->
1555− let y = attachHeader name value x
1556− in y {L.redactHeaders = CI.mk name `S.insert` L.redactHeaders y}
1557−
15581433----------------------------------------------------------------------------
15591434-- Request—Optional parameters—Cookies
15601435
@@ -1762,7 +1637,7 @@ ignoreResponse = Proxy
17621637newtype JsonResponse a = JsonResponse (L.Response a)
17631638 deriving (Show)
17641639
1765−instance (FromJSON a) => HttpResponse (JsonResponse a) where
1640+instance FromJSON a => HttpResponse (JsonResponse a) where
17661641 type HttpResponseBody (JsonResponse a) = a
17671642 toVanillaResponse (JsonResponse r) = r
17681643 getHttpResponse r = do
@@ -1878,14 +1753,14 @@ brReadN br n = go 0 id id
18781753
18791754-- | Get the response body.
18801755responseBody ::
1881− (HttpResponse response) =>
1756+ HttpResponse response =>
18821757 response ->
18831758 HttpResponseBody response
18841759responseBody = L.responseBody . toVanillaResponse
18851760
18861761-- | Get the response status code.
18871762responseStatusCode ::
1888− (HttpResponse response) =>
1763+ HttpResponse response =>
18891764 response ->
18901765 Int
18911766responseStatusCode =
@@ -1893,7 +1768,7 @@ responseStatusCode =
18931768
18941769-- | Get the response status message.
18951770responseStatusMessage ::
1896− (HttpResponse response) =>
1771+ HttpResponse response =>
18971772 response ->
18981773 ByteString
18991774responseStatusMessage =
@@ -1901,7 +1776,7 @@ responseStatusMessage =
19011776
19021777-- | Lookup a particular header from a response.
19031778responseHeader ::
1904− (HttpResponse response) =>
1779+ HttpResponse response =>
19051780 -- | Response interpretation
19061781 response ->
19071782 -- | Header to lookup
@@ -1913,7 +1788,7 @@ responseHeader r h =
19131788
19141789-- | Get the response 'L.CookieJar'.
19151790responseCookieJar ::
1916− (HttpResponse response) =>
1791+ HttpResponse response =>
19171792 response ->
19181793 L.CookieJar
19191794responseCookieJar = L.responseCookieJar . toVanillaResponse
@@ -1967,16 +1842,6 @@ class HttpResponse response where
19671842 acceptHeader :: Proxy response -> Maybe ByteString
19681843 acceptHeader Proxy = Nothing
19691844
1970−-- | This instance has been added to make it easier to inspect 'L.Response'
1971−-- using Req's functions like 'responseStatusCode', 'responseStatusMessage',
1972−-- etc.
1973−--
1974−-- @since 3.12.0
1975−instance HttpResponse (L.Response ()) where
1976− type HttpResponseBody (L.Response ()) = ()
1977− toVanillaResponse = id
1978− getHttpResponse = return . void
1979−
19801845----------------------------------------------------------------------------
19811846-- Other
19821847
@@ -2011,24 +1876,10 @@ data HttpException
20111876 | -- | A wrapper with Aeson-produced 'String' describing why decoding
20121877 -- failed
20131878 JsonHttpException String
2014− deriving (Show, Generic)
1879+ deriving (Show, Typeable, Generic)
20151880
20161881instance Exception HttpException
20171882
2018−-- | Return 'Just' if the given 'HttpException' is wrapping a http-client's
2019−-- 'L.StatusCodeException'. Otherwise, return 'Nothing'.
2020−--
2021−-- @since 3.12.0
2022−isStatusCodeException :: HttpException -> Maybe (L.Response ())
2023−isStatusCodeException
2024− ( VanillaHttpException
2025− ( L.HttpExceptionRequest
2026− _
2027− (L.StatusCodeException r _)
2028− )
2029− ) = Just r
2030−isStatusCodeException _ = Nothing
2031−
20321883-- | A simple type isomorphic to 'Bool' that we only have for better error
20331884-- messages. We use it as a kind and its data constructors as type-level
20341885-- tags.
@@ -2048,4 +1899,4 @@ data Scheme
20481899 Http
20491900 | -- | HTTPS
20501901 Https
2051− deriving (Eq, Ord, Show, Data, Generic, TH.Lift)
1902+ deriving (Eq, Ord, Show, Data, Typeable, Generic, TH.Lift)