Fixed http basic authentication for post requests.
This commit is contained in:
parent
83bc417933
commit
38ee7f30f3
1 changed files with 4 additions and 3 deletions
|
@ -49,16 +49,17 @@ module Import::OTRS
|
||||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||||
end
|
end
|
||||||
request = Net::HTTP::Post.new(uri.request_uri)
|
request = Net::HTTP::Post.new(uri.request_uri)
|
||||||
request.set_form_data(data)
|
|
||||||
response = http.request(request)
|
|
||||||
|
|
||||||
# http basic auth (if needed)
|
# http basic auth (if needed)
|
||||||
user = Setting.get('import_otrs_user');
|
user = Setting.get('import_otrs_user');
|
||||||
password = Setting.get('import_otrs_password');
|
password = Setting.get('import_otrs_password');
|
||||||
if user && user != '' && password && password != ''
|
if user && user != '' && password && password != ''
|
||||||
response.basic_auth user, password
|
request.basic_auth user, password
|
||||||
end
|
end
|
||||||
|
|
||||||
|
request.set_form_data(data)
|
||||||
|
response = http.request(request)
|
||||||
|
|
||||||
if !response
|
if !response
|
||||||
raise "Can't connect to #{url}, got no response!"
|
raise "Can't connect to #{url}, got no response!"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue