Skip to content

Commit a75d6e7

Browse files
committed
fix a httpreplay issue which different order in url fields cause match failed.
1 parent 8e520a7 commit a75d6e7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

httpreplay/scenario.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,19 @@ func (s *Scenario) GetInteractionWithQueryStringFromList(r Request, list []*Inte
292292
var credit int
293293
for m1Key, m1List := range m1 {
294294
if m2List, ok := m2[m1Key]; ok {
295-
if m1List[0] == m2List[0] {
296-
credit++
295+
if len(m1List) < 1 || len(m2List) < 1 || len(m1List) != len(m2List) {
296+
continue
297+
}
298+
299+
for i := range m1List {
300+
m1SortedList := strings.Split(m1List[i], ",")
301+
m2SortedList := strings.Split(m2List[i], ",")
302+
sort.Strings(m1SortedList)
303+
sort.Strings(m2SortedList)
304+
305+
if strings.EqualFold(strings.Join(m1SortedList, "_"), strings.Join(m2SortedList, "_")) {
306+
credit++
307+
}
297308
}
298309
}
299310
}

0 commit comments

Comments
 (0)