<commit_before>module Webpagetest
  # Configures and performs connection requests
  module Connection

    ENDPOINT = 'http://www.webpagetest.org/'

    def get_connection(options = nil)
      options = Hashie::Mash.new( {
        request: :url_encoded,
        response: :logger,
        adapter: Faraday.default_adapter,        
      } ) if options.nil?
      
      url = options.url || ENDPOINT

      connection = Faraday.new(url: url) do |faraday|
        faraday.request  options.request
        faraday.response options.response
        faraday.adapter  options.adapter
      end
    end
  end
end<commit_msg>Add option to override faraday options<commit_after>module Webpagetest
  # Configures and performs connection requests
  module Connection

    ENDPOINT = 'http://www.webpagetest.org/'
    FARADAY_OPTIONS = {
      request: :url_encoded,
      response: :logger,
      adapter: Faraday.default_adapter,
    }

    def get_connection(options = nil)
      options = Hashie::Mash.new(FARADAY_OPTIONS) if options.nil?

      url = options.url || ENDPOINT

      connection = Faraday.new(url: url) do |faraday|
        faraday.request  options.request
        faraday.response options.response unless options.response.nil?
        faraday.adapter  options.adapter
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08282208588957055, 'fraction_numerical': 0.0, 'mean_word_length': 2.635097493036212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5603551', 'n_tokens_mistral': 396, 'n_tokens_neox': 375, 'n_words': 91}