summary refs log tree commit
diff options
context:
space:
mode:
authorLars Gierth <lars.gierth@gmail.com>2012-01-04 04:15:13 +0100
committerLars Gierth <lars.gierth@gmail.com>2012-01-04 04:18:02 +0100
commit5ab871f2a86ca4f943a5b1d0a3d0f32a2f9f77ef (patch)
tree7ddf14669c10302f87a29c84095ab10acb8d9f4b
parente20baec005238f9876281c0d083fe5a4e01aa034 (diff)
downloadrack-5ab871f2a86ca4f943a5b1d0a3d0f32a2f9f77ef.tar.gz
Don't implicitly respond with index file. Fixes #301
-rw-r--r--lib/rack/static.rb2
-rw-r--r--test/spec_static.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/rack/static.rb b/lib/rack/static.rb
index 1b843a0d..727ecbb5 100644
--- a/lib/rack/static.rb
+++ b/lib/rack/static.rb
@@ -38,7 +38,7 @@ module Rack
     def initialize(app, options={})
       @app = app
       @urls = options[:urls] || ["/favicon.ico"]
-      @index = options[:index] || "index.html"
+      @index = options[:index]
       root = options[:root] || Dir.pwd
       cache_control = options[:cache_control]
       @file_server = Rack::File.new(root, cache_control)
diff --git a/test/spec_static.rb b/test/spec_static.rb
index 21b2b6ab..1860d138 100644
--- a/test/spec_static.rb
+++ b/test/spec_static.rb
@@ -40,6 +40,11 @@ describe Rack::Static do
     res.should.be.ok
     res.body.should =~ /index!/
   end
+  
+  it "doesn't call index file if :index option was omitted" do
+    res = @request.get("/")
+    res.body.should == "Hello World"
+  end
 
   it "serves hidden files" do
     res = @hash_request.get("/cgi/sekret")