feat: 【frontend-gray】添加 skipedRoutes以及skipedByHeaders 配置 (#1409)

Co-authored-by: Kent Dong <ch3cho@qq.com>
This commit is contained in:
mamba
2024-10-23 09:34:00 +08:00
committed by GitHub
parent b8f5826a32
commit bb6c43c767
6 changed files with 101 additions and 45 deletions

View File

@@ -108,22 +108,20 @@ func TestPrefixFileRewrite(t *testing.T) {
func TestIsPageRequest(t *testing.T) {
var tests = []struct {
fetchMode string
p string
output bool
p string
output bool
}{
{"cors", "/js/a.js", false},
{"no-cors", "/js/a.js", false},
{"no-cors", "/images/a.png", false},
{"no-cors", "/index", true},
{"cors", "/inde", false},
{"no-cors", "/index.html", true},
{"no-cors", "/demo.php", true},
{"/js/a.js", false},
{"/js/a.js", false},
{"/images/a.png", false},
{"/index", true},
{"/index.html", true},
{"/demo.php", true},
}
for _, test := range tests {
testPath := test.p
t.Run(testPath, func(t *testing.T) {
output := IsPageRequest(test.fetchMode, testPath)
output := IsPageRequest(testPath)
assert.Equal(t, test.output, output)
})
}