aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r--actionpack/lib/action_dispatch/http/mime_type.rb26
-rw-r--r--actionpack/lib/action_dispatch/http/parameters.rb14
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb2
3 files changed, 14 insertions, 28 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb
index b9121a577c..58eb8d0baf 100644
--- a/actionpack/lib/action_dispatch/http/mime_type.rb
+++ b/actionpack/lib/action_dispatch/http/mime_type.rb
@@ -45,32 +45,6 @@ module Mime
return type if type.is_a?(Type)
EXTENSION_LOOKUP.fetch(type.to_s) { |k| yield k }
end
-
- def const_missing(sym)
- ext = sym.downcase
- if Mime[ext]
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- Accessing mime types via constants is deprecated.
- Please change `Mime::#{sym}` to `Mime[:#{ext}]`.
- MSG
- Mime[ext]
- else
- super
- end
- end
-
- def const_defined?(sym, inherit = true)
- ext = sym.downcase
- if Mime[ext]
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- Accessing mime types via constants is deprecated.
- Please change `Mime.const_defined?(#{sym})` to `Mime[:#{ext}]`.
- MSG
- true
- else
- super
- end
- end
end
# Encapsulates the notion of a mime type. Can be used at render time, for example, with:
diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb
index 31ef0af791..ddd15b748b 100644
--- a/actionpack/lib/action_dispatch/http/parameters.rb
+++ b/actionpack/lib/action_dispatch/http/parameters.rb
@@ -12,6 +12,14 @@ module ActionDispatch
}
}
+ # Raised when raw data from the request cannot be parsed by the parser
+ # defined for request's content mime type.
+ class ParseError < StandardError
+ def initialize
+ super($!.message)
+ end
+ end
+
included do
class << self
attr_reader :parameter_parsers
@@ -91,7 +99,7 @@ module ActionDispatch
my_logger = logger || ActiveSupport::Logger.new($stderr)
my_logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{raw_post}"
- raise ParamsParser::ParseError
+ raise ParseError
end
end
@@ -100,4 +108,8 @@ module ActionDispatch
end
end
end
+
+ module ParamsParser
+ ParseError = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("ActionDispatch::ParamsParser::ParseError", "ActionDispatch::Http::Parameters::ParseError")
+ end
end
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index e4ef9783f3..9986d6e1e9 100644
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -357,7 +357,7 @@ module ActionDispatch
end
self.request_parameters = Request::Utils.normalize_encode_params(pr)
end
- rescue ParamsParser::ParseError # one of the parse strategies blew up
+ rescue Http::Parameters::ParseError # one of the parse strategies blew up
self.request_parameters = Request::Utils.normalize_encode_params(super || {})
raise
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e