Tweak test cases: Add raw handler that should not be called (but is).

This commit is contained in:
Matthias Fischmann 2015-09-06 19:30:08 -07:00
parent bfdd0c5e9b
commit a97dd8bc0e

View file

@ -762,14 +762,16 @@ errorRoutingUser404Spec =
type ErrorRoutingBodyParseError
= "sum" :> ReqBody '[JSON] [Int] :> Post '[JSON] Int
:<|> "const" :> Post '[JSON] Int
:<|> Raw
errorRoutingBodyParseErrorSpec :: Spec
errorRoutingBodyParseErrorSpec =
describe "Broken request body triggers error response (not re-routing)" $ do
let hs = (return . sum) :<|> return 2
let hs = (return . sum) :<|> return 2 :<|> (\_ cont -> cont (responseLBS ok200 [] "Raw"))
describe "happy handlers" $ do
go hs "/sum" "[1, 2]" "3"
go hs "/const" "" ("2" { matchStatus = 201 })
go hs "/n/a" "" "Raw"
describe "parse error" $ do
go hs "/sum" "@@@" 400
go hs "/const" "" ("2" { matchStatus = 201 })