mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
Merge pull request #1242 from xucong053/bugfix
fix: deal with extract expr including hyphen
This commit is contained in:
@@ -48,6 +48,7 @@ func (path *APIPath) ToAPI() (*API, error) {
|
||||
return nil, err
|
||||
}
|
||||
err = convertCompatValidator(api.Validators)
|
||||
convertExtract(api.Extract)
|
||||
return api, err
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user