简体   繁体   中英

convert curl request in httparty

how to convert below curl request in httparty

curl --noproxy localhost -k -d '{"username":"admin", "password":"adminpass"}' -H "Content-Type: application/json" https://localhost:8443/api/authentication

got it working

require "httparty"

options = 
{
    :http_proxyaddr => nil,
    :headers => {"Content-Type" => "application/json"},
    :verify => false,
    :body => {"username":"admin", "password":"adminpass"}.to_json
}
response = HTTParty.post('https://localhost:8443/api/authentication', options)

puts response.body

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM