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

Enhance header filtering in getHeadersApplicableToAllResources function to exclude falsy values #588

Merged
merged 3 commits into from
Dec 30, 2024

Conversation

ivanvakulov
Copy link
Contributor

@ivanvakulov ivanvakulov commented Dec 17, 2024

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This pull request includes a small change to the src/utils/headers.ts file. The change ensures that only headers with non-falsy values are included in the result.

  • src/utils/headers.ts: Added a filter to remove headers with falsy values in the getHeadersApplicableToAllResources function.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

src/utils/headers.ts Outdated Show resolved Hide resolved
@vejja
Copy link
Collaborator

vejja commented Dec 19, 2024

@ivanvakulov Thank you very much for this PR
Would you be able to add unit tests to make sure that the functionality works as expected, including for falsy values such as undefined?
I think they probably belong to /test/perRoute
Just want to make sure that setting false somewhere in the hierarchy of route rules won't impact another sub route somewhere

Copy link

vercel bot commented Dec 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
security ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 7:42pm

@ivanvakulov
Copy link
Contributor Author

@vejja Thank you for the review. I've added new tests for publicAssets to ensure there are no empty headers and that headers are correctly set according to the routeRules.

@vejja
Copy link
Collaborator

vejja commented Dec 20, 2024

@Baroshem LGTM

Copy link
Collaborator

@Baroshem Baroshem left a comment

Choose a reason for hiding this comment

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

Amazing work @ivanvakulov

Thanks @vejja for checking it!

@vejja vejja merged commit 9f17263 into nuxt-modules:main Dec 30, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants