Skip to content

Support application/javascript MIME type for JS minification#10

Open
carlosmintfan wants to merge 1 commit into
middlewares:masterfrom
carlosmintfan:master
Open

Support application/javascript MIME type for JS minification#10
carlosmintfan wants to merge 1 commit into
middlewares:masterfrom
carlosmintfan:master

Conversation

@carlosmintfan

Copy link
Copy Markdown

The WHATWG MIME Sniffing Standard lists both text/javascript and application/javascript as valid JavaScript MIME types. Browsers and servers commonly use either.

Changes:

  • Changed $mimetype (string) → $mimetypes (string[]) to support multiple MIME types per compressor
  • Minifier::js() now matches both text/javascript and application/javascript
  • Updated process() to loop through all configured MIME types
  • Added test case for application/javascript content type

Closes #9

The WHATWG MIME Sniffing Standard lists both text/javascript and
application/javascript as valid JavaScript MIME types. Changed the
 property to  (array) so Minifier::js() matches
both, ensuring responses with Content-Type: application/javascript
are also minified.

Closes middlewares#9
@oscarotero
oscarotero requested a review from filisko July 1, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

application/javascript mimetype not supported

1 participant