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

chore: improve trailing slash plugin reliability #238

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

CatchMe2
Copy link
Contributor

@CatchMe2 CatchMe2 commented Feb 21, 2025

Changes

This PR improves logic in stripTrailingSlashPlugin by hardcoding origin. The previous implementation didn't work in case of missing port.

Checklist

  • Apply one of following labels; major, minor, patch or skip-release
  • I've updated the documentation, or no changes were necessary
  • I've updated the tests, or no changes were necessary

)
// Using a hardcoded origin for simplicity and reliability,
// as the request's origin is not relevant in this case.
const { pathname, search } = new URL(request.url, 'https://example.com')
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you also add a new test to ensure whatever case you are beefing up against is covered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're not able to invoke local fastify app without specifying a port. I've changed the implementation, so the passed port doesn't matter.

@CatchMe2 CatchMe2 merged commit 2c08030 into main Feb 21, 2025
4 checks passed
@CatchMe2 CatchMe2 deleted the improve-strip-trailing-slash-reliability branch February 21, 2025 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants