network-api-support 0.2.2 → 0.2.3
raw patch · 4 files changed
+45/−8 lines, 4 filesdep ~aesondep ~http-clientdep ~http-client-tls
Dependency ranges changed: aeson, http-client, http-client-tls, http-types
Files
- http_client_post_0_5/Network/Api/Support/HandleCodes.hs +8/−0
- http_client_pre_0_5/Network/Api/Support/HandleCodes.hs +8/−0
- network-api-support.cabal +24/−5
- src/Network/Api/Support/Core.hs +5/−3
+ http_client_post_0_5/Network/Api/Support/HandleCodes.hs view
@@ -0,0 +1,8 @@+module Network.Api.Support.HandleCodes (+ handleAllResponseCodes+) where++import Network.HTTP.Client++handleAllResponseCodes :: Request -> Request+handleAllResponseCodes = id -- From http_version 0.5 the default is to do nothing
+ http_client_pre_0_5/Network/Api/Support/HandleCodes.hs view
@@ -0,0 +1,8 @@+module Network.Api.Support.HandleCodes (+ handleAllResponseCodes+) where++import Network.HTTP.Client++handleAllResponseCodes :: Request -> Request+handleAllResponseCodes url = url { checkStatus = const . const . const $ Nothing }
network-api-support.cabal view
@@ -1,5 +1,5 @@ Name: network-api-support-Version: 0.2.2+Version: 0.2.3 License: BSD3 License-File: LICENSE Author: Mark Hibberd <mark@hibberd.id.au>@@ -17,6 +17,9 @@ /Note/: Examples of use can be found in the pin and postmark client libraries. +extra-source-files:+ http_client_post_0_5/Network/Api/Support/HandleCodes.hs+ http_client_pre_0_5/Network/Api/Support/HandleCodes.hs Source-Repository head Type: git@@ -25,26 +28,42 @@ Flag small_base Description: Choose the new, split-up base package. +Flag http_client_pre_0_5+ Description: Use version < 0.5 of http-client+ Default: False+ Library Build-Depends: base >= 3 && < 6- , aeson >= 0.5 && < 0.13+ , aeson >= 0.5 && < 1.2 , attoparsec >= 0.10 && < 0.14 , bytestring >= 0.9.1.5 && < 0.11 , case-insensitive >= 0.2 && < 1.3- , http-types >= 0.6 && < 0.9- , http-client >= 0.2.2.2 && < 0.5- , http-client-tls >= 0.2.1.1 && < 0.3+ , http-types >= 0.6 && < 0.10+ , http-client-tls >= 0.2.1.1 && < 0.4 , text >= 0.11 && < 1.3 , time == 1.* , tls >= 1.2.0 && < 1.4 + if flag(http_client_pre_0_5)+ Build-Depends:+ http-client >= 0.2.2.2 && < 0.5+ else+ Build-Depends:+ http-client >= 0.5 && < 0.6 GHC-Options: -Wall -fno-warn-orphans Hs-Source-Dirs: src+ if flag(http_client_pre_0_5)+ Hs-Source-Dirs:+ http_client_pre_0_5+ else+ Hs-Source-Dirs:+ http_client_post_0_5+ Exposed-Modules: Network.Api.Support
src/Network/Api/Support/Core.hs view
@@ -6,6 +6,7 @@ import Network.Api.Support.Request import Network.Api.Support.Response+import Network.Api.Support.HandleCodes import Control.Monad @@ -38,7 +39,8 @@ -> Responder b -> IO b runRequest' settings url transform responder =- do url' <- parseUrl $ unpack url- let url'' = url' { checkStatus = const . const . const $ Nothing } -- handle all response codes.+ do url' <- parseRequest $ unpack url+ let url'' = handleAllResponseCodes url' let req = appEndo transform url''- liftM (responder req) . withManager settings . httpLbs $ req+ manager <- newManager settings+ liftM (responder req) $ httpLbs req manager