Sha256: 709f5520a09c122d39d6ae150aab463ac5747f8a35f9629efdea890a93000886

Contents?: true

Size: 924 Bytes

Versions: 47

Compression:

Stored size: 924 Bytes

Contents

# frozen_string_literal: true

require "abstract_unit"

class MetalControllerInstanceTests < ActiveSupport::TestCase
  class SimpleController < ActionController::Metal
    def hello
      self.response_body = "hello"
    end
  end

  def test_response_does_not_have_default_headers
    original_default_headers = ActionDispatch::Response.default_headers

    ActionDispatch::Response.default_headers = {
      "X-Frame-Options" => "DENY",
      "X-Content-Type-Options" => "nosniff",
      "X-XSS-Protection" => "1;"
    }

    response_headers = SimpleController.action("hello").call(
      "REQUEST_METHOD" => "GET",
      "rack.input" => -> {}
    )[1]

    assert_not response_headers.key?("X-Frame-Options")
    assert_not response_headers.key?("X-Content-Type-Options")
    assert_not response_headers.key?("X-XSS-Protection")
  ensure
    ActionDispatch::Response.default_headers = original_default_headers
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
jets-1.8.2 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.8.1 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.8.0 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.7.2 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.7.1 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.7.0 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.9 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.8 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.7 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.6 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.5 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.4 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.3 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.2 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.1 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.6.0 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.5.10 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.5.9 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.5.8 vendor/rails/actionpack/test/controller/metal_test.rb
jets-1.5.7 vendor/rails/actionpack/test/controller/metal_test.rb