diff --git a/test/Servant/ServerSpec.hs b/test/Servant/ServerSpec.hs index 770bc6c6..1e8113ec 100644 --- a/test/Servant/ServerSpec.hs +++ b/test/Servant/ServerSpec.hs @@ -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