class SecureHeaders::XContentTypeOptions

IE only

Public Class Methods

new(config=nil) click to toggle source
# File lib/secure_headers/headers/x_content_type_options.rb, line 11
def initialize(config=nil)
  @config = config
  validate_config unless @config.nil?
end

Public Instance Methods

name() click to toggle source
# File lib/secure_headers/headers/x_content_type_options.rb, line 16
def name
  X_CONTENT_TYPE_OPTIONS_HEADER_NAME
end
value() click to toggle source
# File lib/secure_headers/headers/x_content_type_options.rb, line 20
def value
  case @config
  when NilClass
    DEFAULT_VALUE
  when String
    @config
  else
    @config[:value]
  end
end

Private Instance Methods

validate_config() click to toggle source
# File lib/secure_headers/headers/x_content_type_options.rb, line 33
def validate_config
  value = @config.is_a?(Hash) ? @config[:value] : @config
  unless value.casecmp(DEFAULT_VALUE) == 0
    raise XContentTypeOptionsBuildError.new("Value can only be nil or 'nosniff'")
  end
end