<commit_before>Feature: Setting request headers

  We recommend you to switch to request specs instead of controller specs if you want to set
  headers in your call.  If you still want to set headers in controller specs, you can use
  `request.headers` as mentioned bellow.

  Scenario: Setting a header value in a controller spec
    Given a file named "spec/controllers/application_controller_spec.rb" with:
      """ruby
      require "rails_helper"

      RSpec.describe ApplicationController, type" :controller do
        controller do
          def show
            if request.headers["Authorization"] == "foo"
              head :ok
            else
              head :forbidden
            end
          end
        end

        before do
          routes.draw { get "show" => "anonymous#show" }
        end

        context "valid Authorization header" do
          it "returns a 200" do
            request.headers["Authorization"] = "foo"

            get :show

            expect(response).to have_http_status(:ok)
          end
        end

        context "invalid Authorization header" do
          it "returns a 403" do
            request.headers["Authorization"] = "bar"

            get :show
<commit_msg>Fix typo in "type: :controller"<commit_after>Feature: Setting request headers

  We recommend you to switch to request specs instead of controller specs if you want to set
  headers in your call.  If you still want to set headers in controller specs, you can use
  `request.headers` as mentioned bellow.

  Scenario: Setting a header value in a controller spec
    Given a file named "spec/controllers/application_controller_spec.rb" with:
      """ruby
      require "rails_helper"

      RSpec.describe ApplicationController, type: :controller do
        controller do
          def show
            if request.headers["Authorization"] == "foo"
              head :ok
            else
              head :forbidden
            end
          end
        end

        before do
          routes.draw { get "show" => "anonymous#show" }
        end

        context "valid Authorization header" do
          it "returns a 200" do
            request.headers["Authorization"] = "foo"

            get :show

            expect(response).to have_http_status(:ok)
          end
        end

        context "invalid Authorization header" do
          it "returns a 403" do
            request.headers["Authorization"] = "bar"

            get :show

{'fraction_non_alphanumeric': 0.06558704453441296, 'fraction_numerical': 0.004858299595141701, 'mean_word_length': 1.9451728247914184, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4640128', 'n_tokens_mistral': 632, 'n_tokens_neox': 597, 'n_words': 242}