@@ -84,15 +84,13 @@ notLongerThan maxAllowed
8484-- /Since 0.0.0.0/
8585onlyJsonObjects :: ResponsePredicate
8686onlyJsonObjects
87− = ResponsePredicate (\resp -> case go resp of
88− Nothing -> throw $ PredicateFailure "onlyJsonObjects" Nothing resp
89− Just () -> return ())
90− where
91− go r = do
92− ctyp <- lookup "content-type" (first foldedCase <$> responseHeaders r)
93− when ("application/json" `SBS.isPrefixOf` ctyp) $ do
94− (_ :: Object) <- decode (responseBody r)
95− return ()
87+ = ResponsePredicate (\resp -> do
88+ case lookup "content-type" (first foldedCase <$> responseHeaders resp) of
89+ Nothing -> return ()
90+ Just ctype -> when ("application/json" `SBS.isPrefixOf` ctype) $ do
91+ case (decode (responseBody resp) :: Maybe Object) of
92+ Nothing -> throw $ PredicateFailure "onlyJsonObjects" Nothing resp
93+ Just _ -> return ())
9694
9795-- | __Optional__
9896--