wreq 0.5.0.1 → 0.5.1.0
raw patch · 7 files changed
+24/−65 lines, 7 filesdep ~timesetup-changedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: time
API changes (from Hackage documentation)
+ Network.Wreq.Session: customPayloadMethodWith :: Postable a => String -> Options -> Session -> String -> a -> IO (Response ByteString)
Files
- Network/Wreq/Cache.hs +2/−2
- Network/Wreq/Session.hs +9/−0
- Setup.hs +1/−59
- changelog.md +6/−0
- examples/UploadPaste.hs +2/−1
- tests/UnitTests.hs +2/−2
- wreq.cabal +2/−1
Network/Wreq/Cache.hs view
@@ -22,7 +22,7 @@ import Data.Maybe (listToMaybe) import Data.Monoid (First(..), mconcat) import Data.Time.Clock (UTCTime, addUTCTime, getCurrentTime)-import Data.Time.Format (parseTime)+import Data.Time.Format (parseTimeM) import Data.Time.Locale.Compat (defaultTimeLocale) import Data.Typeable (Typeable) import GHC.Generics (Generic)@@ -150,4 +150,4 @@ , "%A, %d-%b-%y %H:%M:%S %Z" , "%a %b %e %H:%M:%S %Y" ]- where tryout fmt = First $ parseTime defaultTimeLocale fmt (B.unpack s)+ where tryout fmt = First $ parseTimeM True defaultTimeLocale fmt (B.unpack s)
Network/Wreq/Session.hs view
@@ -65,6 +65,7 @@ , putWith , deleteWith , customMethodWith+ , customPayloadMethodWith -- * Extending a session , Lens.seshRun ) where@@ -177,6 +178,14 @@ -- | 'Session'-specific version of 'Network.Wreq.customMethodWith'. customMethodWith :: String -> Options -> Session -> String -> IO (Response L.ByteString) customMethodWith method opts sesh url = run string sesh =<< prepareMethod methodBS opts url+ where+ methodBS = BC8.pack method++-- | 'Session'-specific version of 'Network.Wreq.customPayloadMethodWith'.+customPayloadMethodWith :: Postable a => String -> Options -> Session -> String -> a+ -> IO (Response L.ByteString)+customPayloadMethodWith method opts sesh url payload =+ run string sesh =<< preparePayloadMethod methodBS opts url payload where methodBS = BC8.pack method
Setup.hs view
@@ -1,64 +1,6 @@--- I don't know who originally wrote this, but I picked it up from--- Edward Kmett's folds package.--{-# OPTIONS_GHC -Wall #-} module Main (main) where -import Data.List (nub)-import Data.Version (showVersion)-import Distribution.Package- (PackageName(PackageName), Package, PackageId, InstalledPackageId,- packageVersion, packageName)-import Distribution.PackageDescription (PackageDescription(), TestSuite(..)) import Distribution.Simple- (defaultMainWithHooks, UserHooks(..), simpleUserHooks)-import Distribution.Simple.BuildPaths (autogenModulesDir)-import Distribution.Simple.LocalBuildInfo- (withLibLBI, withTestLBI, LocalBuildInfo(),- ComponentLocalBuildInfo(componentPackageDeps))-import Distribution.Simple.Setup- (BuildFlags(buildVerbosity), Flag(..), fromFlag,- HaddockFlags(haddockDistPref))-import Distribution.Simple.Utils- (rewriteFile, createDirectoryIfMissingVerbose, copyFiles)-import Distribution.Text (display)-import Distribution.Verbosity (Verbosity, normal)-import System.FilePath ((</>)) main :: IO ()-main = defaultMainWithHooks simpleUserHooks- { buildHook = \pkg lbi hooks flags -> do- generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi- buildHook simpleUserHooks pkg lbi hooks flags- , postHaddock = \args flags pkg lbi -> do- copyFiles normal (haddockOutputDir flags pkg) []- postHaddock simpleUserHooks args flags pkg lbi- }--haddockOutputDir :: Package p => HaddockFlags -> p -> FilePath-haddockOutputDir flags pkg = destDir where- baseDir = case haddockDistPref flags of- NoFlag -> "."- Flag x -> x- destDir = baseDir </> "doc" </> "html" </> display (packageName pkg)--generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo- -> IO ()-generateBuildModule verbosity pkg lbi = do- let dir = autogenModulesDir lbi- createDirectoryIfMissingVerbose verbosity True dir- withLibLBI pkg lbi $ \_ libcfg -> do- withTestLBI pkg lbi $ \suite suitecfg -> do- rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines- [ "module Build_" ++ testName suite ++ " where"- , "deps :: [String]"- , "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))- ]- where- formatdeps = map (formatone . snd)- formatone p = case packageName p of- PackageName n -> n ++ "-" ++ showVersion (packageVersion p)--testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo- -> [(InstalledPackageId, PackageId)]-testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys+main = defaultMain
changelog.md view
@@ -1,5 +1,11 @@ -*- markdown -*- +2017-01-09 0.5.1.0++* Add Session-specific version of Network.Wreq.customPayloadMethodWith++* 8.2 GHC compatibility+ 2017-01-09 0.5.0.0 * Compatible with `http-client` >= 0.5
examples/UploadPaste.hs view
@@ -12,11 +12,12 @@ {-# LANGUAGE OverloadedStrings, TemplateHaskell #-} {-# OPTIONS_GHC -Wall #-} + import Control.Applicative import Control.Lens import Data.Char (toLower) import Data.Maybe (listToMaybe)-import Data.Monoid (mempty)+import Data.Monoid (mempty, (<>)) import Network.Wreq (FormParam((:=)), post, responseBody) import Network.Wreq.Types (FormValue(..)) import Options.Applicative as Opts
tests/UnitTests.hs view
@@ -391,8 +391,8 @@ let go n | n >= 100 = putMVar started Nothing | otherwise = do let port = 8000 + n- startedUp p = putMVar started (Just ("http://localhost:" <> p))- mkCfg = return . setBind ("localhost") . setPort port .+ startedUp p = putMVar started (Just ("http://0.0.0.0:" <> p))+ mkCfg = return . setBind ("0.0.0.0") . setPort port . setVerbose False . setStartupHook (const (startedUp (show port))) serve mkCfg `E.catch` \(_::E.IOException) -> go (n+1)
wreq.cabal view
@@ -1,5 +1,5 @@ name: wreq-version: 0.5.0.1+version: 0.5.1.0 synopsis: An easy-to-use HTTP client library. description: .@@ -37,6 +37,7 @@ category: Web build-type: Custom cabal-version: >=1.10+tested-with: GHC==8.2.1, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 extra-source-files: README.md TODO.md