我有下面的Curl命令,可以从Swagger正常工作,但是当我在Robot Framework Requests库中尝试相同时-我收到“无法编码非2元组的对象”错误。我可能一直想念什么?
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
"dataMap": { \
"TradeBus":{ \
"trade": "Test001", \
"busCode": "op09", \
"test": "XXX", \
"sortOrder": "78654" \
\
} \
} \
} \
' 'https://rxxxxxxx0cd.test.com:7223/service/rest/acct/TradeBus?skipValidation=false'
My Robot Test snippet:
*****************************
*** Variables ***
${Data}= ../Resources/CreateTrdbus.json
*** Test Cases ***
Sample webservice test
${data}= get file ${Data}
${headers}= Create Dictionary Content-type=application/json Accept=application/json
Create Session tWs https://rxxxxxxx0cd.test.com:7223/service/rest
${resp}= POST request tWs /acct/TradeBus/?skipValidation=false headers=${headers} data=${data}
Should Be Equal ${resp.status_code} ${200} msg=WebService call failed
And the Json file content set as below:
{
"dataMap": {
"TradeBus":{
"trade": "Test001",
"busCode": "op09",
"test": "XXX",
"sortOrder": "78654"
} } }