MIME-Types for WEBrick

This commit is contained in:
Jacques Distler 2007-10-08 04:16:31 +00:00
parent ab7f429a10
commit 5cbdccec2a
2 changed files with 14 additions and 3 deletions

View file

@ -8,7 +8,20 @@ OPTIONS = {
:ip => "0.0.0.0", :ip => "0.0.0.0",
:environment => "production", :environment => "production",
:server_root => File.expand_path(File.dirname(__FILE__) + "/../public/"), :server_root => File.expand_path(File.dirname(__FILE__) + "/../public/"),
:server_type => WEBrick::SimpleServer :server_type => WEBrick::SimpleServer,
:mime_types => WEBrick::HTTPUtils::DefaultMimeTypes.merge({
'avi' => 'video/x-msvideo',
'gz' => 'application/x-gzip',
'js' => 'application/x-javascript',
'nb' => 'application/mathematica',
'pdf' => 'application/pdf',
'svg' => 'application/svg+xml',
'tar' => 'application/x-tar',
'tex' => 'application/x-tex',
'xhtml' => 'application/xhtml+xml',
'xml' => 'application/xml',
'xslt' => 'application/xslt+xml'
})
} }
ARGV.options do |opts| ARGV.options do |opts|

View file

@ -87,8 +87,6 @@ class FileControllerTest < Test::Unit::TestCase
# User uploads the picture # User uploads the picture
picture = File.read("#{RAILS_ROOT}/test/fixtures/rails.gif") picture = File.read("#{RAILS_ROOT}/test/fixtures/rails.gif")
# updated from post to get - post fails the spam protection (no javascript) # updated from post to get - post fails the spam protection (no javascript)
# Moron! If substituting GET for POST actually works, you
# have much, much bigger problems.
r = get :file, :web => 'wiki1', r = get :file, :web => 'wiki1',
:file => {:file_name => 'rails-e2e.gif', :file => {:file_name => 'rails-e2e.gif',
:content => StringIO.new(picture), :content => StringIO.new(picture),