mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2026-03-06 19:55:37 +08:00
阶段性提交
This commit is contained in:
27
pkg/serverconfigs/shared/http_status_config.go
Normal file
27
pkg/serverconfigs/shared/http_status_config.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package shared
|
||||
|
||||
// 状态吗
|
||||
type HTTPStatusConfig struct {
|
||||
Always bool `yaml:"always" json:"always"`
|
||||
Codes []int `yaml:"codes" json:"codes"`
|
||||
}
|
||||
|
||||
func (this *HTTPStatusConfig) Init() error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *HTTPStatusConfig) Match(statusCode int) bool {
|
||||
if this.Always {
|
||||
return true
|
||||
}
|
||||
if len(this.Codes) == 0 {
|
||||
return false
|
||||
}
|
||||
for _, c := range this.Codes {
|
||||
if c == statusCode {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user