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

Add Preference-Applied header in response for Prefer: return=representation/headers-only/minimal #2884

Merged
merged 1 commit into from
Aug 5, 2023

Conversation

taimoorzaeem
Copy link
Collaborator

Fixes issue #740.

@taimoorzaeem taimoorzaeem force-pushed the issue740 branch 2 times, most recently from 9e25c56 to 7718c32 Compare July 31, 2023 08:45
Copy link
Member

@steve-chavez steve-chavez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great work!

@steve-chavez steve-chavez merged commit d490bf0 into PostgREST:main Aug 5, 2023
29 checks passed
@taimoorzaeem taimoorzaeem deleted the issue740 branch August 5, 2023 15:31
Comment on lines 300 to 305
-- | Add headers not already included to allow the user to override them instead of duplicating them
addHeadersIfNotIncluded :: [HTTP.Header] -> [HTTP.Header] -> [HTTP.Header]
addHeadersIfNotIncluded newHeaders initialHeaders =
filter (\(nk, _) -> isNothing $ find (\(ik, _) -> ik == nk) initialHeaders) newHeaders ++
filter (\(nk, nv) -> isNothing $ find (\(ik, iv) -> ik == nk && nv == iv) initialHeaders) newHeaders ++
initialHeaders

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says that it prevents duplication of headers. Seems like this is broken (see #2915). Maybe we should add some doc tests to this function to prove it still does what the comment says...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh! I initially did that to allow multiple Preference-Applied, however I forgot to change that back later. I'll send a PR.

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.

4 participants