问题
I'm posting a image (.svg/.png) using Robot Framework (the tabular pythonic way) using the --data-binary flag to test a rest API. The documentation suggests it accepts binary data, but not how to use --data-binary. See robot request docs The post in CURL looks like this:
curl -w "\n%{http_code}\n" -H "Content-Type: image/png" -u user:pass --data-binary "data=@~/someImage.png" -X POST "http://website/{id}"
The test case is formatted like so:
${result} = Post url=${ROOT}/website/{id} data=${if-post-has-data} headers=&{REQ_HEADER}
Any suggestions?
来源:https://stackoverflow.com/questions/45643205/including-data-binary-in-robot-framework-request