在我的黄瓜自动化场景中,我正在使用rest-client在API中提出一些请求。
我正在尝试将宝石更改为Httparty,但我做不到。
url_login = "https://mu.com/login"
header = {'Content-Type': 'application/json'}
payload =
{
"username": "cpd141",
"password": "****",
"agentSign": "ASS"
}.to_json
其他客户宝石
response = RestClient::Request.execute(method: :post, url: url_login, payload: payload, headers: header)
response - <RestClient::Response 200 "{\"id\":\"1436...">
httparty宝石
response = HTTParty.post(url_login,headers: header, body: payload)
response = {"errorMessage"=>"RequestId: 04377c34-709b-41f3-a379-65615fca2681 Process exited before completing request"}