如何在Robot框架中制作POST(ReST)API [英] How to make a POST (ReST) API in Robot framework with
问题描述
我需要在Robot Framework中复制以下API调用:
I need to replicate the below API call in Robot Framework:
curl -X POSThttp:// xyz / api / createApp -HContent-Type:application / json-d @ / tmp / testfile.json
testfile.json有一个json有效载荷。我无法将Json文件的内容作为正文发送。
testfile.json has a json payload. I cannot send the content of Json file as body.
我已经导入了HTTP库。但是看不到用文件进行API调用的任何关键词。
I have imported the HTTP libraries. But do not see any key-word to make an API call with file.
推荐答案
http://bulkan.github.io/robotframework-requests/#Post 有files参数。您可以做的是使用OperatingSystem库中的获取文件
关键字并将其传递给您的Post关键字。
http://bulkan.github.io/robotframework-requests/#Post has files parameter. And what you could do is use Get File
keyword from OperatingSystem library and pass that to your Post keyword.
这篇关于如何在Robot框架中制作POST(ReST)API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!