无法通过httparty发出请求

时间:2019-04-02 19:59:59

标签: ruby rest-client httparty

在我的黄瓜自动化场景中,我正在使用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"}

0 个答案:

没有答案