test suite: Capture strips path snippets
This commit is contained in:
parent
c98c7db0df
commit
d9eaf769d1
1 changed files with 8 additions and 0 deletions
|
@ -11,6 +11,7 @@ module Servant.ServerSpec where
|
||||||
import Control.Monad.Trans.Either
|
import Control.Monad.Trans.Either
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Proxy
|
import Data.Proxy
|
||||||
|
import Data.String
|
||||||
import Data.String.Conversions
|
import Data.String.Conversions
|
||||||
import GHC.Generics
|
import GHC.Generics
|
||||||
import Network.HTTP.Types
|
import Network.HTTP.Types
|
||||||
|
@ -90,6 +91,13 @@ captureSpec = do
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
decode' (simpleBody response) `shouldBe` Just tweety
|
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
|
type GetApi = Get Person
|
||||||
getApi :: Proxy GetApi
|
getApi :: Proxy GetApi
|
||||||
|
|
Loading…
Reference in a new issue