简体   繁体   English

在 httparty 中转换 curl 请求

[英]convert curl request in httparty

how to convert below curl request in httparty如何在httparty中转换低于curl的请求

curl --noproxy localhost -k -d '{"username":"admin", "password":"adminpass"}' -H "Content-Type: application/json" https://localhost:8443/api/authentication 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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