JavaScript Assertion ECMA-6 support for Object.assign
searchcancel
JavaScript Assertion ECMA-6 support for Object.assign
book
Article ID: 189482
calendar_today
Updated On: 11-23-2021
Products
CA API Gateway
Issue/Introduction
When attempting to call the Object.assign() function within the Execute JavaScript Assertion the following exception is generated:
Script failure: Test:javax.script.ScriptException: TypeError: Object.assign is not a function in <eval> at line number 2 Caused by: javax.script.ScriptException: TypeError: Object.assign is not a function in <eval> at line number 2 Caused by: <eval>:2 TypeError: Object.assign is not a function at jdk.nashorn.internal.scripts.Script$Recompilation$8$24$\^eval\_.L:1(<eval>:2) at jdk.nashorn.internal.scripts.Script$5$\^eval\_.:program(<eval>:1) . Exception caught!
Environment
Gateway 9.x
Resolution
The JavaScript assertion is based on the Nashorn engine which supports ECMAScript 5.1(source) . ES6 specific functionality cannot be supported.