Skip to content

Mime type changes to sendFile function #1880

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

Open
jschweik opened this issue Apr 21, 2025 · 1 comment
Open

Mime type changes to sendFile function #1880

jschweik opened this issue Apr 21, 2025 · 1 comment
Labels
docs Issues/pr concerning content enhancement good first issue Issues for newcomers

Comments

@jschweik
Copy link

Description

While migrating from Express 4 to Express 5, we noticed that our previous call to sendFile('foo.js'); was returning the mime type of "text/javascript" for Express 5 vs the previous Express 4 "application/javascript".

Expectations

While the Express 5 migration document clearly stated the move from 'express.static.mime' to the 'mime-types' package, it didn't elaborate that might have unexpected consequences even for those that were not directly using 'express.static.mime' by other methods such as 'sendFile' that is supported in both Express 4 and 5 can return different content type headers than expected because 'mime-types' is using a different value.

This might only be isolated to 'text/javascript' and 'application/javascript', but a full comparison of the two might yield other type differences that users should be aware of.

Making this more clear in either the mime section or the sendFile section would help migrators.

Thanks.

@bjohansebas bjohansebas transferred this issue from expressjs/express Apr 22, 2025
@bjohansebas
Copy link
Member

Pull requests are welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Issues/pr concerning content enhancement good first issue Issues for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants