11package shared
22
3- // 条件配置
3+ // HTTPRequestCondsConfig 条件配置
44// 数据结构:conds -> []groups -> []cond
55type HTTPRequestCondsConfig struct {
66 IsOn bool `yaml:"isOn" json:"isOn"`
@@ -11,7 +11,7 @@ type HTTPRequestCondsConfig struct {
1111 hasResponseConds bool
1212}
1313
14- // 初始化
14+ // Init 初始化
1515func (this * HTTPRequestCondsConfig ) Init () error {
1616 if len (this .Connector ) == 0 {
1717 this .Connector = "or"
@@ -39,7 +39,7 @@ func (this *HTTPRequestCondsConfig) Init() error {
3939 return nil
4040}
4141
42- // 判断请求是否匹配
42+ // MatchRequest 判断请求是否匹配
4343func (this * HTTPRequestCondsConfig ) MatchRequest (formatter func (s string ) string ) bool {
4444 if ! this .IsOn && len (this .Groups ) == 0 {
4545 return true
@@ -61,7 +61,7 @@ func (this *HTTPRequestCondsConfig) MatchRequest(formatter func(s string) string
6161 return ok
6262}
6363
64- // 判断响应是否匹配
64+ // MatchResponse 判断响应是否匹配
6565func (this * HTTPRequestCondsConfig ) MatchResponse (formatter func (s string ) string ) bool {
6666 if ! this .IsOn && len (this .Groups ) == 0 {
6767 return true
@@ -83,12 +83,12 @@ func (this *HTTPRequestCondsConfig) MatchResponse(formatter func(s string) strin
8383 return ok
8484}
8585
86- // 判断是否有请求条件
86+ // HasRequestConds 判断是否有请求条件
8787func (this * HTTPRequestCondsConfig ) HasRequestConds () bool {
8888 return this .hasRequestConds
8989}
9090
91- // 判断是否有响应条件
91+ // HasResponseConds 判断是否有响应条件
9292func (this * HTTPRequestCondsConfig ) HasResponseConds () bool {
9393 return this .hasResponseConds
9494}
0 commit comments