Skip to content

Commit

Permalink
cov: Add coverage overlay for impossible case in corsPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangwalther committed Jan 5, 2022
1 parent 826ae74 commit e13d912
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/PostgREST/Middleware.hs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ corsPolicy req = case lookup "origin" headers of
headers = Wai.requestHeaders req
accHeaders = case lookup "access-control-request-headers" headers of
Just hdrs -> map (CI.mk . BS.strip) $ BS.split ',' hdrs
-- Impossible case, Middleware.Cors will not evaluate this when
-- the Access-Control-Request-Headers header is not set.
Nothing -> []

-- | Set a transaction to eventually roll back if requested and set respective
Expand Down
5 changes: 5 additions & 0 deletions test/coverage.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module "postgrest-9.0.0.20211220-inplace/PostgREST.Middleware" {
inside "corsPolicy" {
tick "[]" on line 133;
}
}

0 comments on commit e13d912

Please sign in to comment.