module Roda::RodaPlugins::DefaultHeaders::ClassMethods

def default_headers

The default response headers to use for the current class.
def default_headers
  opts[:default_headers]
end

def freeze

overridden and all default headers are strings.
Optimize the response class set_default_headers method if it hasn't been
def freeze
  if (headers = opts[:default_headers]).all?{|k, v| k.is_a?(String) && v.is_a?(String)} &&
     (self::RodaResponse.instance_method(:set_default_headers).owner == Base::ResponseMethods)
    self::RodaResponse.class_eval(<<-END, __FILE__, __LINE__+1)
      private
      def set_default_headers
        h = @headers
        #{headers.map{|k,v| "h[#{k.inspect}] ||= #{v.inspect}"}.join('; ')}
      end
    END
  end
  super
end