diff options
author | George Claghorn <george@basecamp.com> | 2018-07-15 19:58:14 -0400 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-07-15 19:58:14 -0400 |
commit | 390097531bd17369f05a23eba58c37b850ac95dd (patch) | |
tree | b2dfaf535680ae6ff94c6fb7ed441b1d348e397a /activestorage/test | |
parent | 5a71a773eab626319d30f35402b9595a26bfe64e (diff) | |
download | rails-390097531bd17369f05a23eba58c37b850ac95dd.tar.gz rails-390097531bd17369f05a23eba58c37b850ac95dd.tar.bz2 rails-390097531bd17369f05a23eba58c37b850ac95dd.zip |
Support HTTP Range downloads from disk
Closes #32193.
Diffstat (limited to 'activestorage/test')
-rw-r--r-- | activestorage/test/controllers/disk_controller_test.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/activestorage/test/controllers/disk_controller_test.rb b/activestorage/test/controllers/disk_controller_test.rb index 9af7c83bdf..32b930730d 100644 --- a/activestorage/test/controllers/disk_controller_test.rb +++ b/activestorage/test/controllers/disk_controller_test.rb @@ -6,8 +6,8 @@ require "database/setup" class ActiveStorage::DiskControllerTest < ActionDispatch::IntegrationTest test "showing blob inline" do blob = create_blob - get blob.service_url + assert_response :ok assert_equal "inline; filename=\"hello.txt\"; filename*=UTF-8''hello.txt", response.headers["Content-Disposition"] assert_equal "text/plain", response.headers["Content-Type"] assert_equal "Hello world!", response.body @@ -15,13 +15,22 @@ class ActiveStorage::DiskControllerTest < ActionDispatch::IntegrationTest test "showing blob as attachment" do blob = create_blob - get blob.service_url(disposition: :attachment) + assert_response :ok assert_equal "attachment; filename=\"hello.txt\"; filename*=UTF-8''hello.txt", response.headers["Content-Disposition"] assert_equal "text/plain", response.headers["Content-Type"] assert_equal "Hello world!", response.body end + test "showing blob range inline" do + blob = create_blob + get blob.service_url, headers: { "Range" => "bytes=5-9" } + assert_response :partial_content + assert_equal "inline; filename=\"hello.txt\"; filename*=UTF-8''hello.txt", response.headers["Content-Disposition"] + assert_equal "text/plain", response.headers["Content-Type"] + assert_equal " worl", response.body + end + test "directly uploading blob with integrity" do data = "Something else entirely!" |