1
問候所有。Ruby on Rails HTTPS Post Bad請求
我的應用程序適用於遠程服務器。服務器使用https證書的授權證書的 。我有以下代碼授權和 發送請求:
uri = URI.parse("https://db1-test.content.ertelecom.ru/")
http = Net::HTTP.new(uri.host, '443')
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
http.ca_file = File.join(File.dirname("public/certificate.pem"),
"certificate.pem")
http.start do |http|
req =
Net::HTTP::Get.new("/cgi-bin/expr/export.get_pay_systems?partner_id=1003")
responce = http.request(req)
resp = responce.body
end
此代碼的工作很好,我從服務器獲取數據。但是,當我嘗試 化妝POST請求:
http.start do |http|
req =
Net::HTTP::Post.new("/cgi-bin/expr/payment_transactions.verify_order",
params)
responce = http.request(req)
resp = responce.body
end
我從服務器得到一個錯誤:
Your browser sent a request that this server could not understand.
Request header field is missing ':' separator.
那是什麼呢?我試圖找到一個解決方案,但無濟於事。 互聯網發現它可能是防病毒軟件,但我在 Linux上。我會很高興任何想法!
奇怪......當我嘗試使用set_form_data我得到: 未定義的方法'set_form_data =」#爲<網:: HTTP: :Post post> 當我使用post_form時: 當你沒有想到它時,你有一個零對象! 評估爲無+ – Finist
所有作品發生錯誤!只需使用以下語法: req.set_form_data(params) – Finist