Improve minifier MIME type resolution

This commit also removes the deprecated `Suffix` from MediaType. Now use `Suffixes` and put the MIME type suffix in the type, e.g. `application/svg+xml`.

Fixes #5093
This commit is contained in:
Bjørn Erik Pedersen 2018-08-28 14:18:12 +02:00
parent 6b9934a266
commit ebb56e8bdb
8 changed files with 87 additions and 106 deletions

View file

@ -32,4 +32,10 @@ func TestNew(t *testing.T) {
assert.NoError(m.Minify(media.CSSType, &b, strings.NewReader("body { color: blue; }")))
assert.Equal("body{color:blue}", b.String())
b.Reset()
// RSS should be handled as XML
assert.NoError(m.Minify(media.RSSType, &b, strings.NewReader("<hello> Hugo! </hello> ")))
assert.Equal("<hello>Hugo!</hello>", b.String())
}