aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/http/mime_negotiation.rb9
-rw-r--r--actionpack/lib/action_dispatch/http/parameters.rb19
-rw-r--r--actionpack/test/dispatch/routing_test.rb1
3 files changed, 11 insertions, 18 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_negotiation.rb b/actionpack/lib/action_dispatch/http/mime_negotiation.rb
index 7acf91902d..004713ec1a 100644
--- a/actionpack/lib/action_dispatch/http/mime_negotiation.rb
+++ b/actionpack/lib/action_dispatch/http/mime_negotiation.rb
@@ -67,6 +67,8 @@ module ActionDispatch
v = if params_readable
Array(Mime[parameters[:format]])
+ elsif format_from_path_extension
+ [Mime[format_from_path_extension]]
elsif use_accept_header && valid_accept_header
accepts
elsif xhr?
@@ -160,6 +162,13 @@ module ActionDispatch
def use_accept_header
!self.class.ignore_accept_header
end
+
+ def format_from_path_extension
+ path = @env['action_dispatch.original_path'] || @env['PATH_INFO']
+ if match = path && path.match(/\.(\w+)\z/)
+ match.captures.first
+ end
+ end
end
end
end
diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb
index 9d450beae5..c9df787351 100644
--- a/actionpack/lib/action_dispatch/http/parameters.rb
+++ b/actionpack/lib/action_dispatch/http/parameters.rb
@@ -41,9 +41,9 @@ module ActionDispatch
# Returns a hash with the \parameters used to form the \path of the request.
# Returned hash keys are strings:
#
- # {'action' => 'my_action', 'controller' => 'my_controller', format => 'html'}
+ # {'action' => 'my_action', 'controller' => 'my_controller'}
def path_parameters
- get_header(PARAMETERS_KEY) || default_path_parameters
+ get_header(PARAMETERS_KEY) || {}
end
private
@@ -66,21 +66,6 @@ module ActionDispatch
def params_parsers
ActionDispatch::Request.parameter_parsers
end
-
- def default_path_parameters
- if format = format_from_path_extension
- { format: format }
- else
- {}
- end
- end
-
- def format_from_path_extension
- path = @env['action_dispatch.original_path'] || @env['PATH_INFO']
- if match = path && path.match(/\.(\w+)\z/)
- match.captures.first
- end
- end
end
end
end
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 1b711e1bf8..8972f3e74d 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -3272,7 +3272,6 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
expected_params = {
controller: 'downloads',
action: 'show',
- format: 'tar',
id: '1'
}