mirror of
https://github.com/alibaba/higress.git
synced 2026-05-11 06:17:26 +08:00
feat: support retry on http status code (#1817)
Co-authored-by: Kent Dong <ch3cho@qq.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user