支持自动转换图像文件为WebP

This commit is contained in:
GoEdgeLab
2021-10-01 16:25:31 +08:00
parent c2ea2c96d5
commit 2ab9a1d68e
5 changed files with 640 additions and 345 deletions

View File

@@ -0,0 +1,21 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package serverconfigs
import (
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestWebPImageConfig_MatchAccept(t *testing.T) {
var a = assert.NewAssertion(t)
{
var c = &WebPImageConfig{}
a.IsFalse(c.MatchAccept(""))
a.IsTrue(c.MatchAccept("image/webp"))
a.IsTrue(c.MatchAccept("image/webp,image/png"))
a.IsTrue(c.MatchAccept("image/jpeg,image/webp,image/png"))
a.IsFalse(c.MatchAccept("mimage/webp"))
a.IsFalse(c.MatchAccept("image/webpm"))
}
}