test suite: Capture strips path snippets

This commit is contained in:
Sönke Hahn 2014-10-28 17:52:47 +08:00
parent c98c7db0df
commit d9eaf769d1

View file

@ -11,6 +11,7 @@ module Servant.ServerSpec where
import Control.Monad.Trans.Either
import Data.Aeson
import Data.Proxy
import Data.String
import Data.String.Conversions
import GHC.Generics
import Network.HTTP.Types
@ -90,6 +91,13 @@ captureSpec = do
liftIO $ do
decode' (simpleBody response) `shouldBe` Just tweety
with (return (serve
(Proxy :: Proxy (Capture "captured" String :> Raw))
(\ "captured" request respond ->
respond $ responseLBS ok200 [] (cs $ show $ pathInfo request)))) $ do
it "strips the captured path snippet from pathInfo" $ do
get "/captured/foo" `shouldRespondWith` (fromString (show ["foo" :: String]))
type GetApi = Get Person
getApi :: Proxy GetApi