MimeMagic: Set mime-type for .js to application/javascript
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 26 Jan 2016 01:33:24 +0000 (01:33 +0000)
committerKrinkle <krinklemail@gmail.com>
Tue, 26 Jan 2016 01:52:36 +0000 (01:52 +0000)
commit2459925e4a9bfc216f79d56416dffd1afc7d3b17
treef31fee6d9e25bed104be1691332abe21a38133ac
parentc00d0b5d94c946b8883dd7062bf7160a199aa5c2
MimeMagic: Set mime-type for .js to application/javascript

The previous "application/x-javascript" was non-standard. It was used as
unregistered mime type by various vendors after stakeholders agreed it
shouldn't be text/javascript anymore, but "application/javascript" was
still pending approval. That was settled in 2006 with RFC 4329.
http://www.iana.org/assignments/media-types/media-types.xhtml
https://tools.ietf.org/html/rfc4329

It also previously inconsistently returned "application/x-javascript" or
"text/javascript" depending on whether you call MimeMagic with or without
the flag that asks for "improved" mime magic (in the latter mode, it picks
the first one from the mime-info list as override).

This makes MimeMagic match the behaviour of HHVM-static server, NGINX,
and Apache 2.4; with regards to Content-Type for .js files.

Change-Id: Idfe0a80c60c548fe28283c62ee9803bff7bdb2d6
includes/MimeMagic.php
includes/mime.info
includes/mime.types
tests/phpunit/includes/MimeMagicTest.php