# File lib/reststop.rb, line 166
  def render(action, format = nil)
    format ||= @format
    
    if format.nil?
      begin
        ct = CONTENT_TYPE
      rescue NameError
        ct = 'text/html'
      end
      @headers['Content-Type'] ||= ct
      
      super(action)
    else
      m = Mab.new({}, self)
      mod = "Camping::Views::#{format.to_s}".constantize
      m.extend mod
      
      begin
        ct = mod::CONTENT_TYPE
      rescue NameError
        ct = "text/#{format.to_s.downcase}"
      end
      @headers['Content-Type'] = ct
      
      s = m.capture{m.send(action)}
      s = m.capture{send(:layout){s}} if /^_/!~a[0].to_s and m.respond_to?(:layout)
      s
    end
  end