增加字符编码/HTTP Header管理

This commit is contained in:
GoEdgeLab
2020-09-16 20:29:26 +08:00
parent 1648192e73
commit afec1c1fe7
22 changed files with 3275 additions and 135 deletions

View File

@@ -0,0 +1,35 @@
package serverconfigs
import (
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestPageConfig_Match(t *testing.T) {
a := assert.NewAssertion(t)
{
page := NewHTTPPageConfig()
page.Status = []string{"200"}
err := page.Init()
if err != nil {
t.Fatal(err)
}
a.IsTrue(page.Match(200))
a.IsFalse(page.Match(201))
}
{
page := NewHTTPPageConfig()
page.Status = []string{"4xx", "5xx"}
err := page.Init()
if err != nil {
t.Fatal(err)
}
a.IsFalse(page.Match(200))
a.IsTrue(page.Match(401))
a.IsTrue(page.Match(404))
a.IsTrue(page.Match(500))
a.IsTrue(page.Match(505))
}
}