Include allow header in options response (#628)

This commit is contained in:
Joe Nelson
2016-06-08 23:12:29 -07:00
parent e272c2ed08
commit e315dbc91e
3 changed files with 29 additions and 11 deletions
+15
View File
@@ -8,6 +8,7 @@ import SpecHelper
import Network.HTTP.Types
import Network.Wai (Application)
import Network.Wai.Test (SResponse(simpleHeaders))
spec :: SpecWith Application
spec = do
@@ -382,3 +383,17 @@ spec = do
it "errors for non existant tables" $
request methodOptions "/dne" [] "" `shouldRespondWith` 404
describe "Allow header" $ do
it "includes read/write verbs for writeable table" $ do
r <- request methodOptions "/items" [] ""
liftIO $
simpleHeaders r `shouldSatisfy`
matchHeader "Allow" "GET,POST,PATCH,DELETE"
it "includes read verbs for read-only table" $ do
r <- request methodOptions "/has_count_column" [] ""
liftIO $
simpleHeaders r `shouldSatisfy`
matchHeader "Allow" "GET"