aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-03-27 15:35:12 -0700
committerJohn Hawthorn <john@hawthorn.email>2019-03-27 16:47:48 -0700
commit06c703570ad353cd13e7b0630ff74cfdb4bbdc21 (patch)
tree183f90385639b6e2ed64d13689e79515fbccf217 /actionpack
parent93dbbe3a81bee6da2f1e88ca6971299b462cad93 (diff)
downloadrails-06c703570ad353cd13e7b0630ff74cfdb4bbdc21.tar.gz
rails-06c703570ad353cd13e7b0630ff74cfdb4bbdc21.tar.bz2
rails-06c703570ad353cd13e7b0630ff74cfdb4bbdc21.zip
Remove :all symbol from Mime::ALL
.all isn't a valid file extension, so it shouldn't used as a symbol. This also makes Mime::ALL better match how */* is parsed from an Accept header.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/http/mime_type.rb2
-rw-r--r--actionpack/test/controller/mime/respond_to_test.rb13
2 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb
index 962d10d81b..88b3a93211 100644
--- a/actionpack/lib/action_dispatch/http/mime_type.rb
+++ b/actionpack/lib/action_dispatch/http/mime_type.rb
@@ -315,7 +315,7 @@ module Mime
include Singleton
def initialize
- super "*/*", :all
+ super "*/*", nil
end
def all?; true; end
diff --git a/actionpack/test/controller/mime/respond_to_test.rb b/actionpack/test/controller/mime/respond_to_test.rb
index 21de05b323..2f8f191828 100644
--- a/actionpack/test/controller/mime/respond_to_test.rb
+++ b/actionpack/test/controller/mime/respond_to_test.rb
@@ -158,6 +158,12 @@ class RespondToController < ActionController::Base
end
end
+ def handle_any_with_template
+ respond_to do |type|
+ type.any { render "test/hello_world" }
+ end
+ end
+
def all_types_with_layout
respond_to do |type|
type.html
@@ -572,6 +578,13 @@ class RespondToControllerTest < ActionController::TestCase
assert_equal "HTML", @response.body
end
+ def test_handle_any_with_template
+ @request.accept = "*/*"
+
+ get :handle_any_with_template
+ assert_equal "Hello world!", @response.body
+ end
+
def test_html_type_with_layout
@request.accept = "text/html"
get :all_types_with_layout