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

Properly support trailingSlash: never with a base #5358

Merged
merged 7 commits into from
Nov 11, 2022
Merged

Conversation

matthewp
Copy link
Contributor

Changes

  • When using trailingSlash: 'never' and a base such as /docs it should allow requests to /docs but not to /docs/.
  • This was a bit tricky to fix given how we remove the base in the dev server and then later put it back. That's why this touches a few different files.
  • It might be worth in the future creating a class / module or something that sort of encapsulates all of the base, trailingSlash, etc. behavior. And then have everything use that.

Testing

  • Unit tests added for the dev server to ensure this works as expected.
  • Unit test added for routing.

Docs

N/A, bug fix

@changeset-bot
Copy link

changeset-bot bot commented Nov 10, 2022

🦋 Changeset detected

Latest commit: 30d8992

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Nov 10, 2022
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Some small nits but looks good. Vite 4 will also be making some base changes soon which may be relevant here: vitejs/vite#10723

packages/astro/src/core/config/schema.ts Outdated Show resolved Hide resolved
packages/astro/src/vite-plugin-astro-server/request.ts Outdated Show resolved Hide resolved
@matthewp matthewp merged commit 9eee0f0 into main Nov 11, 2022
@matthewp matthewp deleted the base-trailing-slash branch November 11, 2022 16:28
@astrobot-houston astrobot-houston mentioned this pull request Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants