test: move http header related tests from io tests to spec tests

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
This commit is contained in:
Taimoor Zaeem
2026-06-16 13:13:51 -05:00
committed by Steve Chavez
parent 8fa26ee865
commit b6c12abf0e
7 changed files with 44 additions and 44 deletions
+34
View File
@@ -0,0 +1,34 @@
module Feature.HttpHeaderSpec where
import Network.HTTP.Types
import Test.Hspec
import Test.Hspec.Wai
import PostgREST.Config (AppConfig (..))
import PostgREST.SchemaCache.Identifiers (QualifiedIdentifier (..))
import Protolude
import SpecHelper
spec :: SpecWithConfig
spec withConfig = do
withConfig baseCfg { configDbPreRequest = Just $ QualifiedIdentifier "test" "custom_vary_hdr" } $
describe "Test HTTP Custom Header" $
it "Test default Vary header value is overridden in pre-request database function" $
request methodGet "/projects" []
""
`shouldRespondWith`
ResponseMatcher
{ matchStatus = 200
, matchBody = MatchBody (\_ _ -> Nothing) -- match any body
, matchHeaders = [ "Vary" <:> "X-Test-Accept" ] }
withConfig baseCfg $ describe "Test HTTP Default Header" $
it "Test default Vary header value matches default one" $
request methodGet "/projects" []
""
`shouldRespondWith`
ResponseMatcher
{ matchStatus = 200
, matchBody = MatchBody (\_ _ -> Nothing) -- match any body
, matchHeaders = [ "Vary" <:> "Accept, Prefer, Range" ] }