Ticket #9524: head_method_content_type_default.diff
| File head_method_content_type_default.diff, 2.0 kB (added by gbuesing, 1 year ago) |
|---|
-
test/controller/new_render_test.rb
old new 251 251 def head_with_location_header 252 252 head :location => "/foo" 253 253 end 254 255 def head_with_content_type_header 256 head :content_type => "text/enriched" 257 end 254 258 255 259 def head_with_symbolic_status 256 260 head :status => params[:status].intern … … 799 803 assert_equal "something", @response.headers["X-Custom-Header"] 800 804 assert_response :forbidden 801 805 end 806 807 def test_head_sets_content_type_header_to_text_plain_by_default 808 get :head_with_location_header 809 assert @response.body.blank? 810 assert_equal "text/plain", @response.content_type 811 assert_response :ok 812 end 813 814 def test_head_sets_content_type_header_to_value_supplied_in_options 815 get :head_with_content_type_header 816 assert @response.body.blank? 817 assert_equal "text/enriched", @response.content_type 818 assert_response :ok 819 end 802 820 803 821 def test_rendering_with_location_should_set_header 804 822 get :render_with_location -
test/controller/rescue_test.rb
old new 115 115 116 116 assert_response :not_found 117 117 assert_equal ' ', @response.body 118 assert_equal 'text/plain', @response.content_type 118 119 end 119 120 120 121 -
lib/action_controller/base.rb
old new 903 903 end 904 904 905 905 raise ArgumentError, "head requires an options hash" if !options.is_a?(Hash) 906 907 options.reverse_merge!(:content_type => Mime::TEXT) 906 908 907 909 status = interpret_status(status || options.delete(:status) || :ok) 908 910