packages feed

apiary-http-client 0.1.2.0 → 0.1.3.0

raw patch · 2 files changed

+8/−10 lines, 2 filesdep −data-default-classdep ~http-client

Dependencies removed: data-default-class

Dependency ranges changed: http-client

Files

Web/Apiary/HTTP/Client.hs view
@@ -30,7 +30,7 @@     -- ** Send request and proxy respond     , proxyTo     , proxyWith-    -- http client exception handler+    -- ** http client exception handler     , forwardBadStatus     , forwardBadStatus'     , module Network.HTTP.Client@@ -45,7 +45,6 @@ import Data.Apiary.Extension import qualified Data.Proxy.Compat as P (Proxy(..)) import Unsafe.Coerce (unsafeCoerce)-import Data.Default.Class import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as LB import qualified Data.ByteString.Builder as B@@ -89,7 +88,7 @@             W.ChunkedBody       -> RequestBodyStreamChunked needsPopper             W.KnownLength len   -> RequestBodyStream (unsafeCoerce len) needsPopper     in-        def {+        defaultRequest {             queryString = W.rawQueryString req         ,   path = T.encodeUtf8 (T.intercalate "/" path)         ,   method = W.requestMethod req@@ -184,16 +183,16 @@ -- |A catch handler which only deal with 'StatusCodeException' --  the status code will be proxy to user. --  any other exceptions will be re-thrown.---  It's intend to use with MonadCatch or MonadBaseControl instance of 'ActionT'+--  It's intend to use with MonadCatch or MonadBaseControl instance of 'A.ActionT' forwardBadStatus :: (Has HTTPClient exts, MonadIO m)     => HttpException -> A.ActionT exts prms m ()-forwardBadStatus (StatusCodeException s h _) = A.status s >> A.stop+forwardBadStatus (HttpExceptionRequest _ (StatusCodeException s h)) = A.status (responseStatus s) >> A.stop forwardBadStatus err = liftIO $ throwIO err  -- |same with 'forwardBadStatus', except that --  any other exceptions will be result in a 404 status with exceptions message.---  It's intend to use with MonadCatch or MonadBaseControl instance of 'ActionT'+--  It's intend to use with MonadCatch or MonadBaseControl instance of 'A.ActionT' forwardBadStatus' :: (Has HTTPClient exts, MonadIO m)     => HttpException -> A.ActionT exts prms m ()-forwardBadStatus' (StatusCodeException s h _) = A.status s >> A.stop+forwardBadStatus' (HttpExceptionRequest _ (StatusCodeException s h)) = A.status (responseStatus s) >> A.stop forwardBadStatus' err = A.status notFound404 >> A.showing err >> A.stop
apiary-http-client.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                apiary-http-client-version:             0.1.2.0+version:             0.1.3.0 synopsis:            A http client for Apiary. description:              A HTTP Client for Apiary, using Apiary's extension api, suitable for proxying HTTP request to backend API, with flexible APIs and streamming proxying abilities.@@ -28,11 +28,10 @@     build-depends:        base                        >=4.6 && <4.9                       ,   transformers                >=0.2   && <0.5                       ,   types-compat                >=0.1   && <0.2-                      ,   http-client                 >=0.4+                      ,   http-client                 >=0.5   && <0.6                       ,   http-types                  >=0.8                       ,   apiary                      >=1.4   && <3.0                       ,   wai                         >=3.0   && <3.3-                      ,   data-default-class                       ,   bytestring                  >=0.10  && <0.11                       ,   bytestring-builder          >=0.10  && <0.11                       ,   text                        >=1.1   && <1.3