Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6233

Show
Ignore:
Timestamp:
02/25/07 20:16:58 (2 years ago)
Author:
david
Message:

Allow send_file/send_data to use a registered mime type as the :type parameter #7620 [jonathan]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r6232 r6233  
    11*SVN* 
     2 
     3* Allow send_file/send_data to use a registered mime type as the :type parameter #7620 [jonathan] 
    24 
    35* Allow routing requirements on map.resource(s) #7633 [quixoten]. Example: 
  • trunk/actionpack/lib/action_controller/streaming.rb

    r6142 r6233  
    125125        headers.update( 
    126126          'Content-Length'            => options[:length], 
    127           'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\r' with some browsers 
     127          'Content-Type'              => options[:type].to_s.strip,  # fixes a problem with extra '\r' with some browsers 
    128128          'Content-Disposition'       => disposition, 
    129129          'Content-Transfer-Encoding' => 'binary' 
  • trunk/actionpack/test/controller/send_file_test.rb

    r6169 r6233  
    2727  include TestFileUtils 
    2828 
     29  Mime::Type.register "image/png", :png unless defined? Mime::PNG 
     30   
    2931  def setup 
    3032    @controller = SendFileController.new 
     
    8486    options = { 
    8587      :length => 1, 
    86       :type => 'type'
     88      :type => Mime::PNG
    8789      :disposition => 'disposition', 
    8890      :filename => 'filename' 
     
    99101    h = @controller.headers 
    100102    assert_equal 1, h['Content-Length'] 
    101     assert_equal 'type', h['Content-Type'] 
     103    assert_equal 'image/png', h['Content-Type'] 
    102104    assert_equal 'disposition; filename="filename"', h['Content-Disposition'] 
    103105    assert_equal 'binary', h['Content-Transfer-Encoding']