我对Httparty很新,我想通过httparty进行用户身份验证。 curl中的命令有效。
curl --data "username=USERNAME&password=PASSWORD&token=132321212" 'https://hekki.isks.com/api/userauth'
我无法将其转换为httparty。到目前为止,我有这个。
response = HTTParty.post("https://hekki.isks.com/api/userauth",
:username => "hello",
:password => "no",
:token => 132321212,
:headers => { 'Content-Type' => 'application/json' } )
答案 0 :(得分:2)
我认为应该是:
response = HTTParty.post("https://hekki.isks.com/api/userauth",
:body=> {
:username => "hello",
:password => "no",
:token => 132321212
} )