Skip to content

Commit

Permalink
Fix issue where tags were not replaced in string responses
Browse files Browse the repository at this point in the history
  • Loading branch information
atainter committed Aug 14, 2024
1 parent 7e28d9c commit fe3fc93
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,13 @@ func (suite TestSuite) executeTest(test TestSpec, extractedFields map[string]int
expectedString, ok := expectedResponse.(string)
if !ok {
testErrors = append(testErrors, fmt.Sprintf("Expected a JSON object, but got a non-JSON response: %s", string(body)))
} else if string(body) != expectedString {
testErrors = append(testErrors, fmt.Sprintf("Expected response payload %s but got %s", expectedString, string(body)))
} else {
processedExpectedBody, err := templateReplace(expectedString, extractedFields)
if err != nil {
testErrors = append(testErrors, fmt.Sprintf("Error comparing actual and expected responses: %v", err))
} else if string(body) != processedExpectedBody {
testErrors = append(testErrors, fmt.Sprintf("Expected response payload %s but got %s", expectedString, string(body)))
}
}
case isMap(r):
differences, err := suite.compareObjects(r.(map[string]interface{}), expectedResponse.(map[string]interface{}), extractedFields, test.Name)
Expand Down

0 comments on commit fe3fc93

Please sign in to comment.