lib/angelo/responder.rb in angelo-0.3.1 vs lib/angelo/responder.rb in angelo-0.3.2

- old
+ new

@@ -5,10 +5,11 @@ class << self attr_writer :default_headers + # top-level setter def content_type type dhs = self.default_headers case type when :json self.default_headers = dhs.merge CONTENT_TYPE_HEADER_KEY => JSON_TYPE @@ -100,17 +101,20 @@ @headers ||= self.class.default_headers.dup @headers.merge! hs if hs @headers end + # route handler helper def content_type type case type when :json headers CONTENT_TYPE_HEADER_KEY => JSON_TYPE when :html headers CONTENT_TYPE_HEADER_KEY => HTML_TYPE when :js headers CONTENT_TYPE_HEADER_KEY => JS_TYPE + when :xml + headers CONTENT_TYPE_HEADER_KEY => XML_TYPE else raise ArgumentError.new "invalid content_type: #{type}" end end