diff options
author | Yves Senn <yves.senn@gmail.com> | 2012-12-30 22:49:46 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2012-12-31 16:08:36 +0100 |
commit | b8c2f3c7692867dfd444d60efb18570ad0fba236 (patch) | |
tree | 378ec5d160a0fdaf2d75cb8f372061d88813ba6b /actionpack/lib/action_dispatch | |
parent | 1304298bd921976b8390a8d90bb533fd493e2867 (diff) | |
download | rails-b8c2f3c7692867dfd444d60efb18570ad0fba236.tar.gz rails-b8c2f3c7692867dfd444d60efb18570ad0fba236.tar.bz2 rails-b8c2f3c7692867dfd444d60efb18570ad0fba236.zip |
charset should not be appended for `head` responses
1) Failure:
test_head_created_with_image_png_content_type(RenderTest) [test/controller/render_test.rb:1238]:
Expected: "image/png"
Actual: "image/png; charset=utf-8"
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/response.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 0f808ac9cf..91cf4784db 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -260,14 +260,18 @@ module ActionDispatch # :nodoc: return if headers[CONTENT_TYPE].present? @content_type ||= Mime::HTML - @charset ||= self.class.default_charset + @charset ||= self.class.default_charset unless @charset == false type = @content_type.to_s.dup - type << "; charset=#{@charset}" unless @sending_file + type << "; charset=#{@charset}" if append_charset? headers[CONTENT_TYPE] = type end + def append_charset? + !@sending_file && @charset != false + end + def rack_response(status, header) assign_default_content_type_and_charset!(header) handle_conditional_get! |