Skip to content

Unwanted charset=UTF-8 always added to custom mime types #350

Closed
@gpoitch

Description

  • Operating System: macOS 10.14
  • Node Version: 10.4.1
  • NPM Version: 6.4.1
  • webpack version: 4.27.1
  • webpack-dev-middleware Version: 3.4.0
  • This is a feature request
  • This is a bug

Since #136, charset=UTF-8 is always appended to the Content-Type header. If I define custom mime types, I believe that this shouldn't be appended.

For example, mobile safari can render 3d/AR models in a native viewer when a file is served with model/vnd.pixar.usd. When setting the option mimeTypes: { 'model/vnd.pixar.usd', ['usdz'] }, the server will return: Content-Type: model/vnd.pixar.usd; charset=UTF-8. The addition of the charset causes the browser to incorrectly interpret the mime type.

This is already special-cased for wasm.

Expected Behavior

charset=UTF-8 is not appended to every Content-Type header when defining custom mimeTypes.

Actual Behavior

charset=UTF-8 is always appended

I can make a PR if you agree on the proposed behavior.

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions