Skip to content

Commit

Permalink
Add test for 'defaultHandler unsets actionErrorHandler' (#339) (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedimahdi authored Dec 16, 2023
1 parent e4d8a12 commit f3366ad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/Web/ScottySpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ spec = do
Scotty.get "/" (liftIO $ E.throwIO E.DivideByZero)) $ do
it "allows to customize the HTTP status code" $ do
get "/" `shouldRespondWith` "" {matchStatus = 503}
withApp (do
let h = Handler (\(_ :: E.SomeException) -> setHeader "Location" "/c" >> status status500)
defaultHandler h
Scotty.get "/a" (redirect "/b")) $ do
it "should give priority to actionErrorHandlers" $ do
get "/a" `shouldRespondWith` 302 { matchHeaders = ["Location" <:> "/b"] }

context "when not specified" $ do
withApp (Scotty.get "/" $ throw E.DivideByZero) $ do
Expand Down

0 comments on commit f3366ad

Please sign in to comment.