问题
Previously i was using karate version 0.8.0. After migrating to 0.9.5 all of my functions where i am using Object.keys
and hasOwnProperty
starts giving me error TypeError: available.hasOwnProperty is not a function
.
In above code available = {
"123": {
"57": 2
}
}
回答1:
Yes these are not supported, as a general rule - use JS only for logic, we don't even advise using JS for loops: https://github.com/intuit/karate#loops
Please use the karate.keysOf() instead, and there are many more similar API-s for other cases.
来源:https://stackoverflow.com/questions/61137654/object-keys-and-hsownproperty-js-functions-are-not-working-in-karate-version-0-9