Sha256: 0a8bda662021cb3ebe37cc20f1a8645ec511f4b29db67b64314f3cbf5e6147f5

Contents?: true

Size: 829 Bytes

Versions: 6

Compression:

Stored size: 829 Bytes

Contents

# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

# In earlier versions of rack < 2.0.0 the Rack::Response and Rack::Request do
# not have get_header or set_header methods. This is our way of working
# around that.
module Rack
  # Our patch into the Rack::Response Class, allowing us to call set_header
  # and get_header in our code without worrying about older versions of
  # Rack not implementing these methods.
  class Response
    unless Rack::Response.instance_methods(true).include?(:set_header)
      def set_header key, value
        headers[key] = value
      end
    end
    unless Rack::Response.instance_methods(true).include?(:get_header)
      def get_header key
        headers[key]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
contrast-agent-3.11.0 lib/contrast/extensions/framework/rack/response.rb
contrast-agent-3.10.2 lib/contrast/extensions/framework/rack/response.rb
contrast-agent-3.10.1 lib/contrast/extensions/framework/rack/response.rb
contrast-agent-3.10.0 lib/contrast/extensions/framework/rack/response.rb
contrast-agent-3.9.1 lib/contrast/extensions/framework/rack/response.rb
contrast-agent-3.9.0 lib/contrast/extensions/framework/rack/response.rb