在opentest中测试API后请求时如何使用FormData



嗨,我在Open Test 的Post方法中使用FormData时出现以下错误

我的代码:

var data = new FormData(); data.append("name", "test")

我得到以下错误:

at org.getopentest.base.TestActor.evalScript(TestActor.java:1441)
at org.getopentest.base.ScriptAction.run(ScriptAction.java:32)
at org.getopentest.base.TestActor.executeAction(TestActor.java:1527)
at org.getopentest.base.TestActor.executeActionByDef(TestActor.java:1695)
... 4 more
Caused by: javax.script.ScriptException: ReferenceError: "FormData" is not defined in <eval> at line number 1
at 

jdk.nashorn.api.scripting.NashornScriptEngine.sthrowAsScriptException(NashornSScriptEngine.java:470(在jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:454(在jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406(在jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402(在jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155(位于javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264(网址:org.getopentest.base.TestActor.evalScript(TestActor.java:1427(

FormData对象仅在web浏览器中可用,并且不是OpenTest API的一部分。如果您试图使用HttpRequest关键字发送请求,您应该能够通过以下方式连接表单字段的键/值对及其值来构建:

field1=value1&field2=value2&field3=value3

更多详细信息请点击此处。

相关内容

  • 没有找到相关文章

最新更新