<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -24,7 +24,8 @@ module ActionController #:nodoc:
       # Options:
       # * &lt;tt&gt;:filename&lt;/tt&gt; - suggests a filename for the browser to use.
       #   Defaults to &lt;tt&gt;File.basename(path)&lt;/tt&gt;.
-      # * &lt;tt&gt;:type&lt;/tt&gt; - specifies an HTTP content type. Defaults to 'application/octet-stream'.
+      # * &lt;tt&gt;:type&lt;/tt&gt; - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
+      #   either a string or a symbol for a registered type register with &lt;tt&gt;Mime::Type.register&lt;/tt&gt;, for example :json
       # * &lt;tt&gt;:length&lt;/tt&gt; - used to manually override the length (in bytes) of the content that
       #   is going to be sent to the client. Defaults to &lt;tt&gt;File.size(path)&lt;/tt&gt;.
       # * &lt;tt&gt;:disposition&lt;/tt&gt; - specifies whether the file will be shown inline or downloaded.
@@ -107,7 +108,8 @@ module ActionController #:nodoc:
       #
       # Options:
       # * &lt;tt&gt;:filename&lt;/tt&gt; - suggests a filename for the browser to use.
-      # * &lt;tt&gt;:type&lt;/tt&gt; - specifies an HTTP content type. Defaults to 'application/octet-stream'.
+      # * &lt;tt&gt;:type&lt;/tt&gt; - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
+      #   either a string or a symbol for a registered type register with &lt;tt&gt;Mime::Type.register&lt;/tt&gt;, for example :json
       # * &lt;tt&gt;:disposition&lt;/tt&gt; - specifies whether the file will be shown inline or downloaded.
       #   Valid values are 'inline' and 'attachment' (default).
       # * &lt;tt&gt;:status&lt;/tt&gt; - specifies the status code to send with the response. Defaults to '200 OK'.
@@ -143,9 +145,16 @@ module ActionController #:nodoc:
 
         disposition &lt;&lt;= %(; filename=&quot;#{options[:filename]}&quot;) if options[:filename]
 
+        content_type = options[:type]
+        if content_type.is_a?(Symbol)
+          raise ArgumentError, &quot;Unknown MIME type #{options[:type]}&quot; unless Mime::EXTENSION_LOOKUP.has_key?(content_type.to_s)
+          content_type = Mime::Type.lookup_by_extension(content_type.to_s)
+        end
+        content_type = content_type.to_s.strip # fixes a problem with extra '\r' with some browsers
+
         headers.update(
           'Content-Length'            =&gt; options[:length],
-          'Content-Type'              =&gt; options[:type].to_s.strip,  # fixes a problem with extra '\r' with some browsers
+          'Content-Type'              =&gt; content_type,
           'Content-Disposition'       =&gt; disposition,
           'Content-Transfer-Encoding' =&gt; 'binary'
         )</diff>
      <filename>actionpack/lib/action_controller/streaming.rb</filename>
    </modified>
    <modified>
      <diff>@@ -119,6 +119,31 @@ class SendFileTest &lt; Test::Unit::TestCase
     assert_equal 'private', h['Cache-Control']
   end
 
+  def test_send_file_headers_with_mime_lookup_with_symbol
+    options = {
+      :length =&gt; 1,
+      :type =&gt; :png
+    }
+
+    @controller.headers = {}
+    @controller.send(:send_file_headers!, options)
+
+    headers = @controller.headers
+
+    assert_equal 'image/png', headers['Content-Type']
+  end
+  
+
+  def test_send_file_headers_with_bad_symbol
+    options = {
+      :length =&gt; 1,
+      :type =&gt; :this_type_is_not_registered
+    }
+
+    @controller.headers = {}
+    assert_raises(ArgumentError){ @controller.send(:send_file_headers!, options) }
+  end
+
   %w(file data).each do |method|
     define_method &quot;test_send_#{method}_status&quot; do
       @controller.options = { :stream =&gt; false, :status =&gt; 500 }</diff>
      <filename>actionpack/test/controller/send_file_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7cda0df7f1511a10c515165dbce76e5c68b654ff</id>
    </parent>
  </parents>
  <author>
    <name>=?utf-8?q?Adam=20Cig=C3=A1nek?=</name>
    <login>metatribe</login>
    <email>adam.ciganek@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/fcd58dc27a99085b161f2463988d4ee373d44ec6</url>
  <id>fcd58dc27a99085b161f2463988d4ee373d44ec6</id>
  <committed-date>2008-12-21T10:58:55-08:00</committed-date>
  <authored-date>2008-12-21T10:58:55-08:00</authored-date>
  <message>Allow use of symbols for :type option of ActionController::Streaming#send_file/#send_data [#1232 state:resolved]

Signed-off-by: Frederick Cheung &lt;frederick.cheung@gmail.com&gt;</message>
  <tree>b137e8fcc185c97068aeae54d8927c6bb3d8f243</tree>
  <committer>
    <name>Frederick Cheung</name>
    <login>fcheung</login>
    <email>frederick.cheung@gmail.com</email>
  </committer>
</commit>
