fix error

This commit is contained in:
邱博亞 2023-05-08 23:16:20 +08:00
parent 2d8efa35d1
commit ee827ff711
1 changed files with 4 additions and 3 deletions

View File

@ -109,13 +109,14 @@ class Admin::RegisterApiController < ApplicationController
end
params_to_send = {'store_token' => store_token, "site_token" => params[:site_token]}
uri = URI.parse("http://#{params[:site_domain]}/")
http = Net::HTTP.new(uri.host,uri.port)
request = Net::HTTP::Post.new("/store/confirmation")
request.body = params_to_send.to_query
begin
success_flag = false
begin
response = http.request(request)
response = Net::HTTP.start(uri.host, uri.port,:use_ssl => uri.scheme == 'https',open_timeout: 10,read_timeout: 10,verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
http.request request
end
success_flag = (response.code == '200')
rescue => e
end
@ -123,7 +124,7 @@ class Admin::RegisterApiController < ApplicationController
return response
else
uri = URI("https://#{params[:site_domain]}/store/confirmation")
response = Net::HTTP.start(uri.host, uri.port,:use_ssl => uri.scheme == 'https',open_timeout: 30,read_timeout: 30,verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
response = Net::HTTP.start(uri.host, uri.port,:use_ssl => uri.scheme == 'https',open_timeout: 10,read_timeout: 10,verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
request = Net::HTTP::Post.new uri
request.set_form_data(params_to_send)
http.request request