http-client-0.5.0 support

This commit is contained in:
Chris Allen 2016-07-06 15:33:39 -05:00
parent e4ff3e4728
commit 0403b19a44
5 changed files with 19 additions and 28 deletions

View File

@ -1,22 +1,9 @@
install-with-test-support:
cabal install --enable-tests
echo "Make certain you have an elasticsearch instance on localhost:9200 !"
cabal test
build:
stack build
test:
echo "Make certain you have an elasticsearch instance on localhost:9200 !"
cabal clean
cabal test
stack test
build:
cabal build
test-repl:
cabal repl tests
repl:
cabal repl
reset:
rm -rf .cabal-sandbox
cabal sandbox init
ghci:
stack ghci

View File

@ -1,5 +1,5 @@
name: bloodhound
version: 0.11.0.0
version: 0.11.1.0
synopsis: ElasticSearch client library for Haskell
description: ElasticSearch made awesome for Haskell hackers
homepage: https://github.com/bitemyapp/bloodhound
@ -33,7 +33,7 @@ library
bytestring >= 0.10.0 && <0.11,
containers >= 0.5.0.0 && <0.6,
aeson >= 0.11.1 && <0.12,
http-client >= 0.3 && <0.5,
http-client >= 0.5 && <0.6,
network-uri >= 2.6 && <2.7,
semigroups >= 0.15 && <0.19,
time >= 1.4 && <1.7,

View File

@ -176,15 +176,17 @@ mkReplicaCount n
emptyBody :: L.ByteString
emptyBody = L.pack ""
dispatch :: MonadBH m => Method -> Text -> Maybe L.ByteString
-> m Reply
dispatch :: MonadBH m
=> Method
-> Text
-> Maybe L.ByteString
-> m Reply
dispatch dMethod url body = do
initReq <- liftIO $ parseUrl' url
reqHook <- bhRequestHook <$> getBHEnv
let reqBody = RequestBodyLBS $ fromMaybe emptyBody body
req <- liftIO $ reqHook $ initReq { method = dMethod
, requestBody = reqBody
, checkStatus = \_ _ _ -> Nothing}
req <- liftIO $ reqHook $ setRequestIgnoreStatus $ initReq { method = dMethod
, requestBody = reqBody }
mgr <- bhManager <$> getBHEnv
liftIO $ httpLbs req mgr
@ -828,7 +830,7 @@ pageSearch :: From -- ^ The result offset
pageSearch resultOffset pageSize search = search { from = resultOffset, size = pageSize }
parseUrl' :: MonadThrow m => Text -> m Request
parseUrl' t = parseUrl (URI.escapeURIString URI.isAllowedInURI (T.unpack t))
parseUrl' t = parseRequest (URI.escapeURIString URI.isAllowedInURI (T.unpack t))
-- | Was there an optimistic concurrency control conflict when
-- indexing a document?

View File

@ -2,10 +2,11 @@ flags: {}
packages:
- '.'
extra-deps:
# - http-client-0.4.24
- http-client-0.5.0
- aeson-0.11.1.0
- fail-4.9.0.0
- http-types-0.9
- http-client-0.4.24
- attoparsec-0.13.0.1
- doctest-0.10.1
- doctest-prop-0.2.0.1

View File

@ -1154,6 +1154,7 @@ main = hspec $ do
searchExpectAggs search
searchValidBucketAgg search "users" toTerms
-- One of these fails with 1.7.3
it "can give execution hint parameters to term aggregations" $ when' (atmost es11) $ withTestEnv $ do
_ <- insertData
searchTermsAggHint [Map, Ordinals]
@ -1165,7 +1166,7 @@ main = hspec $ do
it "can give execution hint parameters to term aggregations" $ when' (atleast es12) $ withTestEnv $ do
_ <- insertData
searchTermsAggHint [GlobalOrdinals, GlobalOrdinalsHash, GlobalOrdinalsLowCardinality, Map]
-- One of the above.
it "can execute value_count aggregations" $ withTestEnv $ do
_ <- insertData