Merge pull request #1242 from xucong053/bugfix

fix: deal with extract expr including hyphen
This commit is contained in:
debugtalk
2022-04-12 17:18:32 +08:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ func (path *APIPath) ToAPI() (*API, error) {
return nil, err
}
err = convertCompatValidator(api.Validators)
convertExtract(api.Extract)
return api, err
}

View File

@@ -170,6 +170,9 @@ func (tc *TCase) makeCompat() error {
if err != nil {
return err
}
// 3. deal with extract expr including hyphen
convertExtract(step.Extract)
}
return nil
}
@@ -212,6 +215,13 @@ func convertCompatValidator(Validators []interface{}) (err error) {
return nil
}
// convertExtract deals with extract expr including hyphen
func convertExtract(extract map[string]string) {
for key, value := range extract {
extract[key] = convertCheckExpr(value)
}
}
// convertCheckExpr deals with check expression including hyphen
func convertCheckExpr(checkExpr string) string {
if strings.Contains(checkExpr, textExtractorSubRegexp) {