lib/twilio-ruby/base/client_base.rb in twilio-ruby-6.3.1 vs lib/twilio-ruby/base/client_base.rb in twilio-ruby-6.4.0

- old
+ new

@@ -25,14 +25,13 @@ # rubocop:enable Metrics/ParameterLists ## # Makes a request to the Twilio API using the configured http client # Authentication information is automatically added if none is provided - # rubocop:disable Lint/ShadowedArgument def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth = nil, timeout = nil) # rubocop:disable Metrics/MethodLength auth ||= @auth - headers = generate_headers(method) + headers = generate_headers(method, headers) uri = build_uri(uri) if @logger @logger.debug('--BEGIN Twilio API Request--') @logger.debug("Request Method: <#{method}>") @@ -66,11 +65,10 @@ @logger.debug('--END TWILIO API REQUEST--') end response end - # rubocop:enable Lint/ShadowedArgument ## # Build the final request uri def build_uri(uri) return uri if @region.nil? && @edge.nil? @@ -103,12 +101,11 @@ return unless response.status_code < 200 || response.status_code >= 300 raise RestError.new 'Unexpected response from certificate endpoint', response end - def generate_headers(method) + def generate_headers(method, headers) ruby_config = RbConfig::CONFIG - headers = {} headers['User-Agent'] = "twilio-ruby/#{Twilio::VERSION} (#{ruby_config['host_os']} #{ruby_config['host_cpu']}) Ruby/#{RUBY_VERSION}" headers['Accept-Charset'] = 'utf-8' user_agent_extensions.each { |extension| headers['User-Agent'] += " #{extension}" }