Skip to content

fix: remove special handling for Accept: text/html #20376

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

Merged

Conversation

sapphi-red
Copy link
Member

Description

This special handling for Accept: text/html was added by 44a30d5 for #2051.

But the original issue seems to be working without this code. Also only checking for Accept: text/html is problematic (#15025).

So I removed this code. I think there won't be any problem, because when you access the path twice, the same behavior happens without this change.

fixes #17340

@sapphi-red sapphi-red added the p2-edge-case Bug, but has workaround or limited in scope (priority) label Jul 8, 2025
hi-ogawa
hi-ogawa previously approved these changes Jul 9, 2025
@sapphi-red
Copy link
Member Author

I added a change to fix the test for #14626.

patak-dev
patak-dev previously approved these changes Jul 14, 2025
Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

It seems it still works without that code because of:

Throwing ERR_LOAD_URL is the same as returning null when calling from the transform middleware: https://github.com/vitejs/vite/pull/10880/files#diff-6d94d6934079a4f09596acc9d3f3d38ea426c6f8e98cd766567335d42679ca7cR227

I would say this is fine, there is a comment already there

// Let other middleware handle if we can't load the url via transformRequest

@patak-dev

This comment was marked as outdated.

Copy link

pkg-pr-new bot commented Jul 14, 2025

Open in StackBlitz

npm i https://pkg.pr.new/vite@20376

commit: fb70e98

@vite-ecosystem-ci

This comment was marked as outdated.

@sapphi-red
Copy link
Member Author

ladle's failure is caused by rollup/rollup#6012. I'll take a look at sveltekit's one.

@sapphi-red
Copy link
Member Author

/ecosystem-ci run

@vite-ecosystem-ci

This comment was marked as outdated.

@vite-ecosystem-ci
Copy link

@sapphi-red sapphi-red changed the title fix: no special handling for Accept: text/html fix: remove special handling for Accept: text/html Jul 16, 2025
@sapphi-red sapphi-red merged commit c9614b9 into vitejs:main Jul 16, 2025
18 checks passed
@sapphi-red sapphi-red deleted the fix/no-special-handling-for-accept-text-html branch July 17, 2025 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority) trigger: preview
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dev server is stateful in regards to env vars
4 participants