Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Middleware.hs #1724

Merged
merged 4 commits into from
Jan 5, 2022

Conversation

wolfgangwalther
Copy link
Member

@wolfgangwalther wolfgangwalther commented Jan 4, 2021

This refactoring increases coverage in Middleware.hs. We still need to add some tests for the error logging part, but this will have to wait until #1717 is merged, so we don't get too many merge conflicts on the IO tests. The haskell stuff is ready for review.

I did:

  • Refactor the logger middleware avoiding the re-implementation of the upstream apache logger
  • Refactor the CORS policy, where the settings were spread out across two functions. Seems like the incorrect Authentication header has been used here so far, too, which should be Authorization. In fact Authorization was used in "defaults", but was immediately overwritten in the other function with Authentication, so never used. Reformatted the test cases here, too.
  • Added a few extra claims to the role claims tests, to increase test coverage in the runPgLocals function.

TODO:

  • Add logging tests

@wolfgangwalther
Copy link
Member Author

Based on #2111 now - need to figure out why those tests are red. After that, this should be good to merge.

@wolfgangwalther
Copy link
Member Author

The loadtest is expected to fail, because it can't deal with removing dependencies in postgrest.cabal. This is because, the nix environment is started on the PR branch, but during postgrest-loadtest-against the main branch is checked out. The main branch will then try to find the now-removed dependency... but can't, because nix doesn't provide it.

@wolfgangwalther wolfgangwalther force-pushed the cover-middleware branch 3 times, most recently from 092a993 to 4e43a43 Compare January 4, 2022 08:38
@wolfgangwalther wolfgangwalther merged commit e13d912 into PostgREST:main Jan 5, 2022
@wolfgangwalther wolfgangwalther deleted the cover-middleware branch January 5, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants