aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-12-20 05:01:42 +1030
committerMatthew Draper <matthew@trebex.net>2016-12-20 05:01:42 +1030
commit51a9311b2d31c77a70b2acc7c03fcd561184ff0d (patch)
tree6f21e888df478244221df4f3eea69e3feac932b3 /actionpack/test
parent3582f58a7558dc0ddb3051b9deb5354aee378b5b (diff)
downloadrails-51a9311b2d31c77a70b2acc7c03fcd561184ff0d.tar.gz
rails-51a9311b2d31c77a70b2acc7c03fcd561184ff0d.tar.bz2
rails-51a9311b2d31c77a70b2acc7c03fcd561184ff0d.zip
Only default the response charset when it is first set
If it is explicitly cleared (e.g., response.sending_file = true), then we should not try to set it again.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/send_file_test.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb
index a28283f4d6..9e6b975fe2 100644
--- a/actionpack/test/controller/send_file_test.rb
+++ b/actionpack/test/controller/send_file_test.rb
@@ -241,10 +241,17 @@ class SendFileTest < ActionController::TestCase
assert_equal "text/calendar; charset=utf-8", response.headers["Content-Type"]
end
+ def test_send_file_charset_with_type_options_key_without_charset
+ @controller = SendFileWithActionControllerLive.new
+ @controller.options = { type: "image/png" }
+ response = process("file")
+ assert_equal "image/png", response.headers["Content-Type"]
+ end
+
def test_send_file_charset_with_content_type_options_key
@controller = SendFileWithActionControllerLive.new
@controller.options = { content_type: "text/calendar" }
response = process("file")
- assert_equal "text/calendar; charset=utf-8", response.headers["Content-Type"]
+ assert_equal "text/calendar", response.headers["Content-Type"]
end
end