wai-test 0.1.1 → 0.1.2
raw patch · 2 files changed
+13/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Network.Wai.Test: assertBodyContains :: ByteString -> SResponse -> Session ()
Files
- Network/Wai/Test.hs +12/−0
- wai-test.cabal +1/−1
Network/Wai/Test.hs view
@@ -13,6 +13,7 @@ , assertStatus , assertContentType , assertBody+ , assertBodyContains , assertHeader , assertNoHeader ) where@@ -32,6 +33,7 @@ import qualified Data.ByteString.Lazy.Char8 as L8 import qualified Network.HTTP.Types as H import Data.CaseInsensitive (CI)+import qualified Data.ByteString as S type Session = ReaderT Application (StateT ClientState IO) @@ -129,6 +131,16 @@ , ", but received " , show $ L8.unpack lbs' ]) $ lbs == lbs'++assertBodyContains :: L.ByteString -> SResponse -> Session ()+assertBodyContains lbs SResponse{simpleBody = lbs'} = assertBool (concat+ [ "Expected response body to contain "+ , show $ L8.unpack lbs+ , ", but received "+ , show $ L8.unpack lbs'+ ]) $ strict lbs `S.isInfixOf` strict lbs'+ where+ strict = S.concat . L.toChunks assertHeader :: CI ByteString -> ByteString -> SResponse -> Session () assertHeader header value SResponse{simpleHeaders = h} =
wai-test.cabal view
@@ -1,5 +1,5 @@ name: wai-test-version: 0.1.1+version: 0.1.2 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>