Skip to content

Commit

Permalink
Merge pull request rack#302 from lgierth/rack-static-bug
Browse files Browse the repository at this point in the history
Don't implicitly respond with index file. Fixes rack#301
  • Loading branch information
raggi committed Jan 7, 2012
2 parents e20baec + 5ab871f commit 5c60fc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/static.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Static
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)
Expand Down
5 changes: 5 additions & 0 deletions test/spec_static.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def call(env)
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")
Expand Down

0 comments on commit 5c60fc5

Please sign in to comment.