mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Enable option for index.html to be a directories default (#640)
This commit is contained in:
parent
268e501a63
commit
05d55540b9
3 changed files with 24 additions and 4 deletions
|
@ -23,6 +23,15 @@ describe Kemal::StaticFileHandler do
|
|||
response.body.should eq(File.read("#{__DIR__}/static/dir/test.txt"))
|
||||
end
|
||||
|
||||
it "should serve the 'index.html' file when a directory is requested and index serving is enabled" do
|
||||
serve_static({"dir_index" => true})
|
||||
response = handle HTTP::Request.new("GET", "/dir/")
|
||||
response.status_code.should eq(200)
|
||||
response.headers["Content-Type"].should eq "text/html"
|
||||
response.headers["Etag"].should contain "W/\""
|
||||
response.body.should eq(File.read("#{__DIR__}/static/dir/index.html"))
|
||||
end
|
||||
|
||||
it "should respond with 304 if file has not changed" do
|
||||
response = handle HTTP::Request.new("GET", "/dir/test.txt")
|
||||
response.status_code.should eq(200)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue