Public Instance methods
content_type()
Return the content-type of the response. Will be nil if it has not yet been explicitly set.
[show source]
# File lib/roda/plugins/response_content_type.rb 62 def content_type 63 @headers[RodaResponseHeaders::CONTENT_TYPE] 64 end
content_type=(mime_type)
Set the content-type of the response. If given a string, it is used directly. If given a symbol, looks up the mime type with the given file extension. If the symbol is not a recognized mime type, raises KeyError.
[show source]
# File lib/roda/plugins/response_content_type.rb 70 def content_type=(mime_type) 71 mime_type = roda_class.opts[:repsonse_content_types].fetch(mime_type) if mime_type.is_a?(Symbol) 72 @headers[RodaResponseHeaders::CONTENT_TYPE] = mime_type 73 end