packages feed

rest-core 0.31 → 0.31.1

raw patch · 4 files changed

+15/−7 lines, 4 filesdep ~aeson

Dependency ranges changed: aeson

Files

CHANGELOG.md view
@@ -1,6 +1,11 @@ # Changelog -### 0.31+### 0.31.1++* Expose `Rest.Driver.Routing.splitUriString`.+* Make test cases compile again.++## 0.31  * Schema: `action` has been renamed to `static` since it is tied to `statics` and to disambiguate it from the unrelated `actions`. 
rest-core.cabal view
@@ -1,5 +1,5 @@ name:                rest-core-version:             0.31+version:             0.31.1 description:         Rest API library. synopsis:            Rest API library. maintainer:          code@silk.co@@ -75,3 +75,4 @@     , rest-core     , test-framework == 0.8.*     , test-framework-hunit == 0.3.*+    , unordered-containers == 0.2.*
src/Rest/Driver/Routing.hs view
@@ -17,6 +17,7 @@   , mkMultiHandler    , UriParts+  , splitUriString   ) where  import Prelude hiding (id, (.))
tests/Runner.hs view
@@ -11,7 +11,6 @@ import Test.Framework.Providers.HUnit (testCase) import Test.HUnit (Assertion, assertEqual, assertFailure) -import qualified Data.ByteString.Char8 as Char8 import qualified Data.HashMap.Strict   as H  import Rest.Api hiding (route)@@ -166,6 +165,8 @@ testMultiGet :: Assertion testMultiGet = checkRouteSuccess GET "" (Rest.root :: Rest.Router IO IO) +type Uri = String+ checkSingleRoute :: (Applicative m, Monad m, Monad s)                  => Uri -> Resource m s sid mid aid -> Handler s -> Assertion checkSingleRoute uri resource handler_ =@@ -190,14 +191,14 @@  checkRouteFailure :: Method -> Uri -> Rest.Router m s -> Assertion checkRouteFailure method uri router =-  case route method (splitUri $ "v1.0/" <> uri) [(Version 1 0 Nothing, Some1 router)] of+  case route method (splitUriString $ "v1.0/" <> uri) [(Version 1 0 Nothing, Some1 router)] of     Left _  -> return ()-    Right _ -> assertFailure ("Should be no route to " ++ show method ++ " " ++ Char8.unpack uri ++ ".")+    Right _ -> assertFailure ("Should be no route to " ++ show method ++ " " ++ uri ++ ".")  checkRouteSuccess :: Method -> Uri -> Rest.Router m s -> Assertion checkRouteSuccess method uri router =-  case route method (splitUri $ "v1.0/" <> uri) [(Version 1 0 Nothing, Some1 router)] of-    Left e  -> assertFailure ("No route to " ++ show method ++ " " ++ Char8.unpack uri ++ ": " ++ show e)+  case route method (splitUriString $ "v1.0/" <> uri) [(Version 1 0 Nothing, Some1 router)] of+    Left e  -> assertFailure ("No route to " ++ show method ++ " " ++ uri ++ ": " ++ show e)     Right _ -> return ()  allMethods :: [Method]