Skip to content

Commit 7538b51

Browse files
Added tests for verifying content length presence in response headers
1 parent 65014e2 commit 7538b51

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

activestorage/test/controllers/blobs/proxy_controller_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ class ActiveStorage::Blobs::ProxyControllerTest < ActionDispatch::IntegrationTes
137137
assert request.session_options[:skip],
138138
"Expected request.session_options[:skip] to be true"
139139
end
140+
141+
test "rails_storage_proxy include Content-Length header" do
142+
Rails.application.config.active_storage.resolve_model_to_route = :rails_storage_proxy
143+
blob = create_file_blob(filename: "racecar.jpg")
144+
145+
get rails_storage_proxy_url(blob)
146+
147+
assert_response :success
148+
assert_not_nil response.headers["Content-Length"], "Content-Length header should be included in proxy mode"
149+
assert_equal blob.byte_size.to_s, response.headers["Content-Length"], "Content-Length header should match blob size"
150+
end
140151
end
141152

142153
class ActiveStorage::Blobs::ExpiringProxyControllerTest < ActionDispatch::IntegrationTest

0 commit comments

Comments
 (0)