Skip to content

Mime type changes to sendFile function #1880

Open
@jschweik

Description

@jschweik

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions