feat: support retry on http status code (#1817)

Co-authored-by: Kent Dong <ch3cho@qq.com>
This commit is contained in:
Se7en
2025-03-11 13:38:02 +08:00
committed by GitHub
parent beb60fcacd
commit 19496e5759
7 changed files with 72 additions and 18 deletions

View File

@@ -1,8 +1,20 @@
package util
import regexp "github.com/wasilibs/go-re2"
func StripPrefix(s string, prefix string) string {
if len(prefix) != 0 && len(s) >= len(prefix) && s[0:len(prefix)] == prefix {
return s[len(prefix):]
}
return s
}
func MatchStatus(status string, patterns []string) bool {
for _, pattern := range patterns {
matched, _ := regexp.MatchString(pattern, status)
if matched {
return true
}
}
return false
}