This commit is contained in:
Yvan
2026-08-17 15:23:57 +08:00
parent 05b49cd86a
commit 083cc3a9ea
24 changed files with 639 additions and 287 deletions
+14 -4
View File
@@ -3,10 +3,20 @@ package data
import "testing"
func TestDefaultIgnoredAPIsIncludeSwagger(t *testing.T) {
for _, api := range defaultIgnoredAPIs() {
if api.Method == "GET" && api.Path == "/swagger/*any" {
return
wants := map[string]bool{
"GET /swagger/*any": false,
"GET /uploads/file/*filepath": false,
"HEAD /uploads/file/*filepath": false,
}
for _, api := range defaultIgnoredAPIs("uploads/file") {
key := api.Method + " " + api.Path
if _, ok := wants[key]; ok {
wants[key] = true
}
}
for key, found := range wants {
if !found {
t.Fatalf("default ignored APIs do not include %s", key)
}
}
t.Fatal("default ignored APIs do not include the Swagger handler")
}