lib/apidiesel/handlers/http_request_helper.rb in apidiesel-0.9 vs lib/apidiesel/handlers/http_request_helper.rb in apidiesel-0.10

- old
+ new

@@ -9,13 +9,17 @@ # @param [Hash] payload the request body # @param [Hash] api_config the configuration data of the Apidiesel::Api # instance, as given to the handlers #run method # def execute_request(request:, payload:, api_config:) - http_request = HTTPI::Request.new(request.action.url.try(:to_s)) + http_request = HTTPI::Request.new(request.url.try(:to_s)) http_request.body = payload + if api_config[:http_basic_username] && api_config[:http_basic_password] + http_request.auth.basic(api_config[:http_basic_username], api_config[:http_basic_password]) + end + http_request.auth.ssl.verify_mode = api_config[:ssl_verify_mode] || :peer http_request.open_timeout = api_config[:timeout] || 30 http_request.read_timeout = api_config[:timeout] || 30 request.http_request = http_request @@ -26,10 +30,10 @@ rescue => e raise RequestError.new(e, request) end if response.error? - raise RequestError.new("#{request.action.http_method} #{request.action.url} returned #{response.code}", request) + raise RequestError.new("#{request.action.http_method} #{request.url} returned #{response.code}", request) end request end end \ No newline at end of file