allow empty route type

default field
This commit is contained in:
风扇滑翔翼 2023-12-22 18:27:03 +08:00 committed by yuhan6665
parent f51bf98714
commit 9becf02316

View file

@ -636,7 +636,7 @@ func ParseRule(msg json.RawMessage) (*router.RoutingRule, error) {
if err != nil { if err != nil {
return nil, newError("invalid router rule").Base(err) return nil, newError("invalid router rule").Base(err)
} }
if strings.EqualFold(rawRule.Type, "field") { if rawRule.Type == "" || strings.EqualFold(rawRule.Type, "field") {
fieldrule, err := parseFieldRule(msg) fieldrule, err := parseFieldRule(msg)
if err != nil { if err != nil {
return nil, newError("invalid field rule").Base(err) return nil, newError("invalid field rule").Base(err)