<commit_before>require 'faraday'

module Faraday
  class Request::OAuth < Faraday::Middleware
    dependency 'simple_oauth'

    def call(env)
      params = env[:body].is_a?(Hash) ? env[:body] : {}

      signature_params = params.reject{ |k,v| v.respond_to?(:content_type) }

      header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options)

      env[:request_headers]['Authorization'] = header.to_s

      @app.call(env)
    end

    def initialize(app, options)
      @app, @options = app, options
    end
  end
end<commit_msg>Don't set params to an empty hash unless body is nil<commit_after>require 'faraday'

module Faraday
  class Request::OAuth < Faraday::Middleware
    dependency 'simple_oauth'

    def call(env)
      params = env.fetch(:body, {})

      signature_params = params.reject{ |k,v| v.respond_to?(:content_type) }

      header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options)

      env[:request_headers]['Authorization'] = header.to_s

      @app.call(env)
    end

    def initialize(app, options)
      @app, @options = app, options
    end
  end
end
{'fraction_non_alphanumeric': 0.13192612137203166, 'fraction_numerical': 0.0, 'mean_word_length': 3.6260162601626016, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4983751', 'n_tokens_mistral': 375, 'n_tokens_neox': 361, 'n_words': 82}