packages feed

hreq-client 0.1.0.0 → 0.1.1.0

raw patch · 5 files changed

+22/−7 lines, 5 filesdep ~hreq-corePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hreq-core

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@-## Hreq-Client 0.1.0.0+## Hreq-Client 0.1.1.0++* Matching status codes with in response.++One can specify that a certain status code is expected in the http response+and when its not received we throw an error.++## Hreq-Client 0.1.1.0  * Initial public release
README.md view
@@ -1,7 +1,7 @@ # Hreq -[![Hackage](https://img.shields.io/hackage/v/hreq.svg?logo=haskell)](https://hackage.haskell.org/package/hreq)+[![Hackage](https://img.shields.io/hackage/v/hreq-client.svg?logo=haskell)](https://hackage.haskell.org/package/hreq-client) [![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)-[![Build status](https://img.shields.io/travis/epicallan/hreq.svg?logo=travis)](https://travis-ci.org/epicallan/hreq)+[![Build status](https://img.shields.io/travis/epicallan/hreq.svg?logo=travis&branch=master)](https://travis-ci.org/epicallan/hreq)  Implementation of Hreq Client. An HTTP client basing on hreq-core. Please look at the repository [README.md](https://github.com/epicallan/hreq/blob/master/README.md) file for more.
example/Main.hs view
@@ -28,8 +28,12 @@ getAllUsers :: RunClient m => m [User] getAllUsers = hreq @("all" :> GetJson [User]) Empty -createUser :: RunClient m => User -> m ()-createUser user = hreq @(JsonBody User :> EmptyResponse POST) (user :. Empty)+createUser :: RunClient m => User -> m User+createUser user = hreq @(JsonBody User :> PostJson User) (user :. Empty)++-- | status code should match 200 otherwise throw an error+statusEx :: RunClient m => m (Hlist '[ User ])+statusEx = hreq @(Verb GET '[ ResStatus 200, ResBody JSON User]) Empty  -- | Don't run main without supplying a functioning baseUrl. main :: IO ()
hreq-client.cabal view
@@ -1,6 +1,6 @@ cabal-version: >= 2.0 name:           hreq-client-version:        0.1.0.0+version:        0.1.1.0 synopsis:       A Type dependent Highlevel HTTP client library. description:    A Type dependent highlevel HTTP client library inspired by servant-client. category:       Network, Web@@ -45,7 +45,7 @@     exceptions           >= 0.10.0 && < 0.11,     http-client          >= 0.6.4 && < 0.7,     http-client-tls      >= 0.3.5 && < 0.4,-    hreq-core            >= 0.1.0,+    hreq-core            >= 0.1.1,     http-media           >= 0.8.0 && < 0.9,     http-types           >= 0.12.3 && < 0.13,     mtl                  >= 2.2.2 && < 3.0,
test/Hreq/HttpBin/SuccessSpec.hs view
@@ -17,6 +17,10 @@        r  <- runHttpBin $ hreq @("get" :> RawResponse GET) Empty        resStatusCode r `shouldBe` 200 +    it "works with specifying status codes where by received code must match expected" $ do+       r <- runHttpBin $ hreq @(Verb GET '[ ResStatus 200 ]) Empty+       resStatusCode r `shouldBe` 200+     it "works with post requests" $ do        r  <- runHttpBin                $ hreq @("post" :> JsonBody String :> PostJson Value) ("foo" :. Empty)