Early return from range if request type is not GET

This commit is contained in:
Sdogruyol 2017-02-04 13:35:46 +03:00
parent 0543142a10
commit 476b27892e
5 changed files with 37 additions and 40 deletions

View file

@ -1,30 +1,30 @@
require "./spec_helper"
describe "Run" do
it "runs a code block after starting" do
Kemal.config.env = "test"
make_me_true = false
Kemal.run do
make_me_true = true
Kemal.stop
end
make_me_true.should eq true
end
it "runs without a block being specified" do
Kemal.config.env = "test"
Kemal.run
Kemal.config.running.should eq true
Kemal.stop
end
it "runs with just a block" do
Kemal.config.env = "test"
make_me_true = false
Kemal.run do
make_me_true = true
Kemal.stop
end
make_me_true.should eq true
end
end
require "./spec_helper"
describe "Run" do
it "runs a code block after starting" do
Kemal.config.env = "test"
make_me_true = false
Kemal.run do
make_me_true = true
Kemal.stop
end
make_me_true.should eq true
end
it "runs without a block being specified" do
Kemal.config.env = "test"
Kemal.run
Kemal.config.running.should eq true
Kemal.stop
end
it "runs with just a block" do
Kemal.config.env = "test"
make_me_true = false
Kemal.run do
make_me_true = true
Kemal.stop
end
make_me_true.should eq true
end
end

View file

@ -119,9 +119,9 @@ describe Kemal::StaticFileHandler do
match = response.headers["Content-Range"].match(/bytes (\d+)-(\d+)\/(\d+)/)
match.should_not be nil
if match
start_range = match[1].to_i {0}
end_range = match[2].to_i {0}
range_size = match[3].to_i {0}
start_range = match[1].to_i { 0 }
end_range = match[2].to_i { 0 }
range_size = match[3].to_i { 0 }
range_size.should eq file_size
(end_range < file_size).should eq true