soap 0.2.3.3 → 0.2.3.4
raw patch · 6 files changed
+48/−27 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- LICENSE +14/−14
- changelog +8/−0
- soap.cabal +2/−2
- src/Network/SOAP/Parsing/Stream.hs +4/−0
- src/Network/SOAP/Transport/HTTP.hs +1/−1
- test/Main.hs +19/−10
LICENSE view
@@ -1,20 +1,20 @@-Copyright (c) 2013 Alexander Bondarenko+Copyright (c) 2013-2017 Alexander Bondarenko -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to +Permission is hereby granted, free of charge, to any person obtaining a+copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
changelog view
@@ -1,3 +1,11 @@+0.2.3.4:++ * Prepare for xml-conduit-1.5 series.++0.2.3.3:++ * Relax envelope parser.+ 0.2.3.2: * Unbreak the build with GHC 7.8.
soap.cabal view
@@ -1,5 +1,5 @@ name: soap-version: 0.2.3.3+version: 0.2.3.4 synopsis: SOAP client tools description: Tools to build SOAP clients using xml-conduit.@@ -48,7 +48,7 @@ license-file: LICENSE author: Alexander Bondarenko maintainer: aenor.realm@gmail.com--- copyright: +copyright: (c) 2013-2017 Alexander Bondarenko category: Web build-type: Simple cabal-version: >=1.8
src/Network/SOAP/Parsing/Stream.hs view
@@ -33,7 +33,11 @@ -- | Namespace- and attribute- ignorant tagNoAttr. laxTag :: (MonadThrow m) => Text -> Sink Event m a -> Sink Event m (Maybe a)+#if MIN_VERSION_xml_conduit(1,5,0)+laxTag ln = XSP.tag' (XSP.matching $ (== ln) . nameLocalName) XSP.ignoreAttrs . const+#else laxTag ln = XSP.tagPredicate ((== ln) . nameLocalName) XSP.ignoreAttrs . const+#endif -- | Non-maybe version of laxTag/tagNoAttr. flaxTag :: (MonadThrow m) => Text -> Sink Event m a -> Sink Event m a
src/Network/SOAP/Transport/HTTP.hs view
@@ -144,7 +144,7 @@ -> Transport runQueryM manager url requestProc bodyProc soapAction doc = do let body = renderLBS def $! doc-#if MIN_VERSION_http_client(0,4,3)+#if MIN_VERSION_http_client(0,4,30) request <- parseRequest url #else request <- parseUrl url
test/Main.hs view
@@ -1,10 +1,10 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} import Network.SOAP import Network.SOAP.Exception import Network.SOAP.Parsing.Cursor import Network.SOAP.Parsing.Stream import qualified Network.SOAP.Transport.Mock as Mock-import qualified Network.SOAP.Transport.HTTP as HTTP import Text.XML import Text.XML.Writer import Text.XML.Cursor as Cur hiding (element)@@ -13,10 +13,10 @@ import Data.Text (Text) import qualified Data.Text as T import qualified Data.HashMap.Strict as HM-import qualified Data.ByteString.Lazy.Char8 as LBS import Test.Hspec +main :: IO () main = hspec $ do describe "Transport.Mock" $ do it "dispatches requests" $ do@@ -38,20 +38,20 @@ describe "CursorParser" $ do let salad cur = head $ cur $/ laxElement "salad" - let check parser = do+ let checkCP parser = do t <- Mock.initTransport [ ("spam", saladHandler )]- invokeWS t "spam" () () parser+ invokeWS t "spam" () () (CursorParser parser) it "reads content" $ do- result <- check $ CursorParser (readT "bacon" . salad)+ result <- checkCP $ readT "bacon" . salad result `shouldBe` "many" it "reads and converts" $ do- result <- check $ CursorParser (readC "eggs" . salad)+ result <- checkCP $ readC "eggs" . salad result `shouldBe` (2 :: Integer) it "reads dict" $ do- result <- check $ CursorParser (readDict $ laxElement "salad" )+ result <- checkCP $ readDict $ laxElement "salad" result `shouldBe` HM.fromList [ ("bacon","many") , ("sausage","some") , ("eggs","2")@@ -59,9 +59,14 @@ describe "StreamParser" $ do it "extracts stuff" $ do let recipeParser = do- ings <- Parse.force "no salad" $ Parse.tagNoAttr "salad" $ Parse.many $ Parse.tag Just return $ \name -> do- quantity <- Parse.content- return $ RecipeEntry (nameLocalName name) quantity+ ings <- Parse.force "no salad" . Parse.tagNoAttr "salad" . Parse.many $+#if MIN_VERSION_xml_conduit(1,5,0)+ Parse.tag Parse.anyName pure $ \name -> do+#else+ Parse.tag Just return $ \name -> do+#endif+ quantity <- Parse.content+ return $ RecipeEntry (nameLocalName name) quantity return $ Recipe ings t <- spamTransport@@ -100,12 +105,15 @@ , faultDetail = "" } +invokeSpam :: ResponseParser b -> IO b invokeSpam parser = do t <- spamTransport invokeWS t "spam" () () parser +spamTransport :: IO Transport spamTransport = Mock.initTransport [ ("spam", saladHandler) ] +saladHandler :: Mock.Handler saladHandler = Mock.handler $ \_ -> do return . element "salad" $ do element "sausage" ("some" :: Text)@@ -115,6 +123,7 @@ data RecipeEntry = RecipeEntry Text Text deriving (Eq, Show) data Recipe = Recipe [RecipeEntry] deriving (Eq, Show) +saladRecipe :: Recipe saladRecipe = Recipe [ RecipeEntry "sausage" "some" , RecipeEntry "bacon" "many" , RecipeEntry "eggs" "2"