Skip to content

Commit 5131406

Browse files
Update command.go
Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
1 parent 2084e6c commit 5131406

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

command.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,25 +4508,24 @@ func parseCommandPolicies(commandInfoTips map[string]string) *routing.CommandPol
45084508
req := routing.ReqDefault
45094509
resp := routing.RespAllSucceeded
45104510

4511-
if commandInfoTips != nil {
4512-
if v, ok := commandInfoTips[requestPolicy]; ok {
4511+
4512+
tips := make(map[string]string, len(commandInfoTips))
4513+
for k, v := range commandInfoTips {
4514+
if k == requestPolicy {
45134515
if p, err := routing.ParseRequestPolicy(v); err == nil {
45144516
req = p
45154517
}
4518+
continue
45164519
}
4517-
if v, ok := commandInfoTips[responsePolicy]; ok {
4520+
if k == responsePolicy {
45184521
if p, err := routing.ParseResponsePolicy(v); err == nil {
45194522
resp = p
45204523
}
4521-
}
4522-
}
4523-
tips := make(map[string]string, len(commandInfoTips))
4524-
for k, v := range commandInfoTips {
4525-
if k == requestPolicy || k == responsePolicy {
45264524
continue
45274525
}
45284526
tips[k] = v
45294527
}
4528+
45304529
return &routing.CommandPolicy{Request: req, Response: resp, Tips: tips}
45314530
}
45324531

0 commit comments

Comments
 (0)