This commit is contained in:
23
run_tests.go
23
run_tests.go
@@ -196,6 +196,29 @@ func RunTest(testCase *TestCase) error {
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range captureData.Header.Data {
|
||||
fmt.Printf("Searching header response for match on capture string '%s'\n", k)
|
||||
|
||||
results := findKey(k, testCase.ResultBodyMap)
|
||||
//fmt.Printf("Results : '%v'\n", results)
|
||||
|
||||
if len(results) > 0 {
|
||||
//fmt.Printf("Found %d results but only storing the first one\n", len(results))
|
||||
|
||||
// Get the type of the first element
|
||||
valueType := reflect.TypeOf(results[0])
|
||||
|
||||
// Check if the type is not string
|
||||
if valueType.Kind() != reflect.String {
|
||||
// Convert the value to string
|
||||
results[0] = fmt.Sprintf("%v", results[0])
|
||||
}
|
||||
|
||||
fmt.Printf("Storing capture '%s' = '%s'\n", k, results[0].(string))
|
||||
captureValues.Data[v] = results[0].(string)
|
||||
}
|
||||
}
|
||||
|
||||
// Capture anything needed
|
||||
break
|
||||
}
|
||||
|
Reference in New Issue
Block a user