<commit_before>require "rspec/default_http_header/version"

module RSpec
  module DefaultHttpHeader
    extend ActiveSupport::Concern

    HTTP_METHODS = %w(get post put delete patch)

    included do
      let(:default_headers) { {} }

      HTTP_METHODS.each do |m|
        if ActionPack::VERSION::MAJOR >= 5
          define_method(m) do |path, *args|
            if args[0].respond_to?(:has_key?) && args[0].has_key?(:headers)
              args[0][:headers].merge!(default_headers)
            end

            super(path, *args)
          end
        else<commit_msg>fixed overwrite args and when args empty set default_headers<commit_after>require "rspec/default_http_header/version"

module RSpec
  module DefaultHttpHeader
    extend ActiveSupport::Concern

    HTTP_METHODS = %w(get post put delete patch)

    included do
      let(:default_headers) { {} }

      HTTP_METHODS.each do |m|
        if ActionPack::VERSION::MAJOR >= 5
          define_method(m) do |path, *args|
            args[0] ||= {}
            args[0][:headers] = if args[0].has_key?(:headers)
                                  default_headers.merge(args[0][:headers])
                                else
                                  default_headers
                                end

            super(path, *args)
          end
        else
{'fraction_non_alphanumeric': 0.0990990990990991, 'fraction_numerical': 0.006756756756756757, 'mean_word_length': 1.9041394335511983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1860954', 'n_tokens_mistral': 387, 'n_tokens_neox': 369, 'n_words': 82}