actionpack 7.2.2.2 → 7.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -0
  3. data/README.rdoc +1 -1
  4. data/lib/abstract_controller/base.rb +1 -12
  5. data/lib/abstract_controller/collector.rb +1 -1
  6. data/lib/abstract_controller/helpers.rb +1 -1
  7. data/lib/action_controller/metal/live.rb +1 -1
  8. data/lib/action_controller/metal/params_wrapper.rb +3 -3
  9. data/lib/action_controller/metal/redirecting.rb +4 -3
  10. data/lib/action_controller/metal/rendering.rb +1 -1
  11. data/lib/action_controller/metal/request_forgery_protection.rb +3 -1
  12. data/lib/action_controller/metal/strong_parameters.rb +0 -3
  13. data/lib/action_controller/renderer.rb +0 -1
  14. data/lib/action_dispatch/constants.rb +6 -0
  15. data/lib/action_dispatch/http/mime_negotiation.rb +8 -3
  16. data/lib/action_dispatch/http/request.rb +4 -3
  17. data/lib/action_dispatch/http/response.rb +15 -1
  18. data/lib/action_dispatch/http/url.rb +2 -2
  19. data/lib/action_dispatch/journey/formatter.rb +8 -3
  20. data/lib/action_dispatch/journey/gtg/transition_table.rb +4 -4
  21. data/lib/action_dispatch/middleware/debug_exceptions.rb +3 -1
  22. data/lib/action_dispatch/middleware/exception_wrapper.rb +3 -3
  23. data/lib/action_dispatch/middleware/executor.rb +5 -2
  24. data/lib/action_dispatch/middleware/public_exceptions.rb +5 -1
  25. data/lib/action_dispatch/routing/mapper.rb +5 -5
  26. data/lib/action_dispatch/testing/assertion_response.rb +1 -1
  27. data/lib/action_dispatch/testing/integration.rb +2 -3
  28. data/lib/action_dispatch/testing/request_encoder.rb +9 -9
  29. data/lib/action_dispatch/testing/test_process.rb +1 -2
  30. data/lib/action_pack/gem_version.rb +2 -2
  31. metadata +26 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de497a4bfe038de60adf6ae41286240f2876e6708be4aa79f87639cf7c1b95d3
4
- data.tar.gz: 77b807fbf7571a65674d4b78affdcc0c54821c935d6ec6634ee8e5fe63a13015
3
+ metadata.gz: e774a50c3ffb6c9c4f387e2bf3632992f1979e8b050cdd481e0ff41fc289f4d4
4
+ data.tar.gz: b433f1b952b2cca2850d40a668bbf4196a72dd1981ede7714348607cb79fadb1
5
5
  SHA512:
6
- metadata.gz: f8761d3f2b5c3be0bfd48360b9f568974a34c47752357b56b81a751068e5b27bc3b26a2474274be3653f3b822042c371346c502d61afc35f95fee4a614e93ee9
7
- data.tar.gz: 0cda820f77379fa28d2243069428fbd068f7020b7ee1d9555b315e4924c9e866d8d08ff30d2b7e67680fe2fcd9706f435f9f542edf8ef8b4f84f4788858b48e0
6
+ metadata.gz: 7c48de1742782bbad870035834911eb2bac273330d2d34317c2d670f02d762d9998f024491fe37e17b8628f4255844d66fec7522bb47e10668e0a775e160e6c4
7
+ data.tar.gz: d72cf3db810cc51bfca8ff37af293e22a4089838ec00fb8cc44dce15d77255937a7221a90b6fdd2dc38f01803abd42757641b5fb665d6c121111bf3e548022f4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,46 @@
1
+ ## Rails 7.2.3 (October 28, 2025) ##
2
+
3
+ * Submit test requests using `as: :html` with `Content-Type: x-www-form-urlencoded`
4
+
5
+ *Sean Doyle*
6
+
7
+ * Address `rack 3.2` deprecations warnings.
8
+
9
+ ```
10
+ warning: Status code :unprocessable_entity is deprecated and will be removed in a future version of Rack.
11
+ Please use :unprocessable_content instead.
12
+ ```
13
+
14
+ Rails API will transparently convert one into the other for the forseable future.
15
+
16
+ *Earlopain*, *Jean Boussier*
17
+
18
+ * Always return empty body for HEAD requests in `PublicExceptions` and
19
+ `DebugExceptions`.
20
+
21
+ This is required by `Rack::Lint` (per RFC9110).
22
+
23
+ *Hartley McGuire*
24
+
25
+ * Fix `url_for` to handle `:path_params` gracefully when it's not a `Hash`.
26
+
27
+ Prevents various security scanners from causing exceptions.
28
+
29
+ *Martin Emde*
30
+
31
+ * Fix `ActionDispatch::Executor` to unwrap exceptions like other error reporting middlewares.
32
+
33
+ *Jean Boussier*
34
+
35
+ * Fix NoMethodError when a non-string CSRF token is passed through headers.
36
+
37
+ *Ryan Heneise*
38
+
39
+ * Fix invalid response when rescuing `ActionController::Redirecting::UnsafeRedirectError` in a controller.
40
+
41
+ *Alex Ghiculescu*
42
+
43
+
1
44
  ## Rails 7.2.2.2 (August 13, 2025) ##
2
45
 
3
46
  * No changes.
data/README.rdoc CHANGED
@@ -52,6 +52,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
52
52
 
53
53
  * https://github.com/rails/rails/issues
54
54
 
55
- Feature requests should be discussed on the rails-core mailing list here:
55
+ Feature requests should be discussed on the rubyonrails-core forum here:
56
56
 
57
57
  * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -86,14 +86,10 @@ module AbstractController
86
86
  controller.public_instance_methods(true) - methods
87
87
  end
88
88
 
89
- # A list of method names that should be considered actions. This includes all
89
+ # A `Set` of method names that should be considered actions. This includes all
90
90
  # public instance methods on a controller, less any internal methods (see
91
91
  # internal_methods), adding back in any methods that are internal, but still
92
92
  # exist on the class itself.
93
- #
94
- # #### Returns
95
- # * `Set` - A set of all methods that should be considered actions.
96
- #
97
93
  def action_methods
98
94
  @action_methods ||= begin
99
95
  # All public instance methods of this class, including ancestors except for
@@ -121,9 +117,6 @@ module AbstractController
121
117
  #
122
118
  # MyApp::MyPostsController.controller_path # => "my_app/my_posts"
123
119
  #
124
- # #### Returns
125
- # * `String`
126
- #
127
120
  def controller_path
128
121
  @controller_path ||= name.delete_suffix("Controller").underscore unless anonymous?
129
122
  end
@@ -147,10 +140,6 @@ module AbstractController
147
140
  # The actual method that is called is determined by calling #method_for_action.
148
141
  # If no method can handle the action, then an AbstractController::ActionNotFound
149
142
  # error is raised.
150
- #
151
- # #### Returns
152
- # * `self`
153
- #
154
143
  def process(action, ...)
155
144
  @_action_name = action.to_s
156
145
 
@@ -27,7 +27,7 @@ module AbstractController
27
27
  def method_missing(symbol, ...)
28
28
  unless mime_constant = Mime[symbol]
29
29
  raise NoMethodError, "To respond to a custom format, register it as a MIME type first: " \
30
- "https://guides.rubyonrails.org/action_controller_overview.html#restful-downloads. " \
30
+ "https://guides.rubyonrails.org/action_controller_advanced_topics.html#restful-downloads. " \
31
31
  "If you meant to respond to a variant like :tablet or :phone, not a custom format, " \
32
32
  "be sure to nest your variant response within a format response: " \
33
33
  "format.html { |html| html.tablet { ... } }"
@@ -90,7 +90,7 @@ module AbstractController
90
90
  #--
91
91
  # Implemented by Resolution#modules_for_helpers.
92
92
 
93
- # :method: # all_helpers_from_path
93
+ # :method: all_helpers_from_path
94
94
  # :call-seq: all_helpers_from_path(path)
95
95
  #
96
96
  # Returns a list of helper names in a given path.
@@ -58,7 +58,7 @@ module ActionController
58
58
 
59
59
  module ClassMethods
60
60
  def make_response!(request)
61
- if request.get_header("HTTP_VERSION") == "HTTP/1.0"
61
+ if (request.get_header("SERVER_PROTOCOL") || request.get_header("HTTP_VERSION")) == "HTTP/1.0"
62
62
  super
63
63
  else
64
64
  Live::Response.new.tap do |res|
@@ -198,14 +198,14 @@ module ActionController
198
198
  # # enables the parameter wrapper for XML format
199
199
  #
200
200
  # wrap_parameters :person
201
- # # wraps parameters into +params[:person]+ hash
201
+ # # wraps parameters into params[:person] hash
202
202
  #
203
203
  # wrap_parameters Person
204
204
  # # wraps parameters by determining the wrapper key from Person class
205
- # # (+person+, in this case) and the list of attribute names
205
+ # # (:person, in this case) and the list of attribute names
206
206
  #
207
207
  # wrap_parameters include: [:username, :title]
208
- # # wraps only +:username+ and +:title+ attributes from parameters.
208
+ # # wraps only :username and :title attributes from parameters.
209
209
  #
210
210
  # wrap_parameters false
211
211
  # # disables parameters wrapping for this controller altogether.
@@ -106,13 +106,14 @@ module ActionController
106
106
 
107
107
  allow_other_host = response_options.delete(:allow_other_host) { _allow_other_host }
108
108
 
109
- self.status = _extract_redirect_to_status(options, response_options)
109
+ proposed_status = _extract_redirect_to_status(options, response_options)
110
110
 
111
111
  redirect_to_location = _compute_redirect_to_location(request, options)
112
112
  _ensure_url_is_http_header_safe(redirect_to_location)
113
113
 
114
114
  self.location = _enforce_open_redirect_protection(redirect_to_location, allow_other_host: allow_other_host)
115
115
  self.response_body = ""
116
+ self.status = proposed_status
116
117
  end
117
118
 
118
119
  # Soft deprecated alias for #redirect_back_or_to where the `fallback_location`
@@ -211,9 +212,9 @@ module ActionController
211
212
 
212
213
  def _extract_redirect_to_status(options, response_options)
213
214
  if options.is_a?(Hash) && options.key?(:status)
214
- Rack::Utils.status_code(options.delete(:status))
215
+ ActionDispatch::Response.rack_status_code(options.delete(:status))
215
216
  elsif response_options.key?(:status)
216
- Rack::Utils.status_code(response_options[:status])
217
+ ActionDispatch::Response.rack_status_code(response_options[:status])
217
218
  else
218
219
  302
219
220
  end
@@ -232,7 +232,7 @@ module ActionController
232
232
  end
233
233
 
234
234
  if options[:status]
235
- options[:status] = Rack::Utils.status_code(options[:status])
235
+ options[:status] = ActionDispatch::Response.rack_status_code(options[:status])
236
236
  end
237
237
 
238
238
  super
@@ -142,6 +142,7 @@ module ActionController # :nodoc:
142
142
  #
143
143
  #
144
144
  # Built-in unverified request handling methods are:
145
+ #
145
146
  # * `:exception` - Raises ActionController::InvalidAuthenticityToken
146
147
  # exception.
147
148
  # * `:reset_session` - Resets the session.
@@ -170,6 +171,7 @@ module ActionController # :nodoc:
170
171
  #
171
172
  #
172
173
  # Built-in session token strategies are:
174
+ #
173
175
  # * `:session` - Store the CSRF token in the session. Used as default if
174
176
  # `:store` option is not specified.
175
177
  # * `:cookie` - Store the CSRF token in an encrypted cookie.
@@ -498,7 +500,7 @@ module ActionController # :nodoc:
498
500
  # Checks the client's masked token to see if it matches the session token.
499
501
  # Essentially the inverse of `masked_authenticity_token`.
500
502
  def valid_authenticity_token?(session, encoded_masked_token) # :doc:
501
- if encoded_masked_token.nil? || encoded_masked_token.empty? || !encoded_masked_token.is_a?(String)
503
+ if !encoded_masked_token.is_a?(String) || encoded_masked_token.empty?
502
504
  return false
503
505
  end
504
506
 
@@ -1118,9 +1118,6 @@ module ActionController
1118
1118
  keys - params.keys - always_permitted_parameters
1119
1119
  end
1120
1120
 
1121
- #
1122
- # --- Filtering ----------------------------------------------------------
1123
- #
1124
1121
  # This is a list of permitted scalar types that includes the ones supported in
1125
1122
  # XML and JSON requests.
1126
1123
  #
@@ -96,7 +96,6 @@ module ActionController
96
96
  # * `:script_name` - The portion of the incoming request's URL path that
97
97
  # corresponds to the application. Converts to Rack's `SCRIPT_NAME`.
98
98
  # * `:input` - The input stream. Converts to Rack's `rack.input`.
99
- #
100
99
  # * `defaults` - Default values for the Rack env. Entries are specified in the
101
100
  # same format as `env`. `env` will be merged on top of these values.
102
101
  # `defaults` will be retained when calling #new on a renderer instance.
@@ -30,5 +30,11 @@ module ActionDispatch
30
30
  SERVER_TIMING = "server-timing"
31
31
  STRICT_TRANSPORT_SECURITY = "strict-transport-security"
32
32
  end
33
+
34
+ if Gem::Version.new(Rack::RELEASE) < Gem::Version.new("3.1")
35
+ UNPROCESSABLE_CONTENT = :unprocessable_entity
36
+ else
37
+ UNPROCESSABLE_CONTENT = :unprocessable_content
38
+ end
33
39
  end
34
40
  end
@@ -56,9 +56,14 @@ module ActionDispatch
56
56
 
57
57
  # Returns the MIME type for the format used in the request.
58
58
  #
59
- # GET /posts/5.xml | request.format => Mime[:xml]
60
- # GET /posts/5.xhtml | request.format => Mime[:html]
61
- # GET /posts/5 | request.format => Mime[:html] or Mime[:js], or request.accepts.first
59
+ # # GET /posts/5.xml
60
+ # request.format # => Mime[:xml]
61
+ #
62
+ # # GET /posts/5.xhtml
63
+ # request.format # => Mime[:html]
64
+ #
65
+ # # GET /posts/5
66
+ # request.format # => Mime[:html] or Mime[:js], or request.accepts.first
62
67
  #
63
68
  def format(_view_path = nil)
64
69
  formats.first || Mime::NullType.instance
@@ -132,7 +132,7 @@ module ActionDispatch
132
132
 
133
133
  # Populate the HTTP method lookup cache.
134
134
  HTTP_METHODS.each { |method|
135
- HTTP_METHOD_LOOKUP[method] = method.underscore.to_sym
135
+ HTTP_METHOD_LOOKUP[method] = method.downcase.underscore.to_sym
136
136
  }
137
137
 
138
138
  alias raw_request_method request_method # :nodoc:
@@ -236,8 +236,9 @@ module ActionDispatch
236
236
  #
237
237
  # send_early_hints("link" => "</style.css>; rel=preload; as=style,</script.js>; rel=preload")
238
238
  #
239
- # If you are using `javascript_include_tag` or `stylesheet_link_tag` the Early
240
- # Hints headers are included by default if supported.
239
+ # If you are using {javascript_include_tag}[rdoc-ref:ActionView::Helpers::AssetTagHelper#javascript_include_tag]
240
+ # or {stylesheet_link_tag}[rdoc-ref:ActionView::Helpers::AssetTagHelper#stylesheet_link_tag]
241
+ # the Early Hints headers are included by default if supported.
241
242
  def send_early_hints(links)
242
243
  env["rack.early_hints"]&.call(links)
243
244
  end
@@ -46,6 +46,20 @@ module ActionDispatch # :nodoc:
46
46
  Headers = ::Rack::Utils::HeaderHash
47
47
  end
48
48
 
49
+ class << self
50
+ if ActionDispatch::Constants::UNPROCESSABLE_CONTENT == :unprocessable_content
51
+ def rack_status_code(status) # :nodoc:
52
+ status = :unprocessable_content if status == :unprocessable_entity
53
+ Rack::Utils.status_code(status)
54
+ end
55
+ else
56
+ def rack_status_code(status) # :nodoc:
57
+ status = :unprocessable_entity if status == :unprocessable_content
58
+ Rack::Utils.status_code(status)
59
+ end
60
+ end
61
+ end
62
+
49
63
  # To be deprecated:
50
64
  Header = Headers
51
65
 
@@ -245,7 +259,7 @@ module ActionDispatch # :nodoc:
245
259
 
246
260
  # Sets the HTTP status code.
247
261
  def status=(status)
248
- @status = Rack::Utils.status_code(status)
262
+ @status = Response.rack_status_code(status)
249
263
  end
250
264
 
251
265
  # Sets the HTTP response's content MIME type. For example, in the controller you
@@ -272,7 +272,7 @@ module ActionDispatch
272
272
  end
273
273
  end
274
274
 
275
- # Returns whether this request is using the standard port
275
+ # Returns whether this request is using the standard port.
276
276
  #
277
277
  # req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:80'
278
278
  # req.standard_port? # => true
@@ -307,7 +307,7 @@ module ActionDispatch
307
307
  standard_port? ? "" : ":#{port}"
308
308
  end
309
309
 
310
- # Returns the requested port, such as 8080, based on SERVER_PORT
310
+ # Returns the requested port, such as 8080, based on SERVER_PORT.
311
311
  #
312
312
  # req = ActionDispatch::Request.new 'SERVER_PORT' => '80'
313
313
  # req.server_port # => 80
@@ -60,8 +60,13 @@ module ActionDispatch
60
60
 
61
61
  def generate(name, options, path_parameters)
62
62
  original_options = options.dup
63
- path_params = options.delete(:path_params) || {}
64
- options = path_params.merge(options)
63
+ path_params = options.delete(:path_params)
64
+ if path_params.is_a?(Hash)
65
+ options = path_params.merge(options)
66
+ else
67
+ path_params = nil
68
+ options = options.dup
69
+ end
65
70
  constraints = path_parameters.merge(options)
66
71
  missing_keys = nil
67
72
 
@@ -79,7 +84,7 @@ module ActionDispatch
79
84
  # top-level params' normal behavior of generating query_params should be
80
85
  # preserved even if the same key is also a bind_param
81
86
  parameterized_parts.key?(key) || route.defaults.key?(key) ||
82
- (path_params.key?(key) && !original_options.key?(key))
87
+ (path_params&.key?(key) && !original_options.key?(key))
83
88
  end
84
89
 
85
90
  defaults = route.defaults
@@ -107,10 +107,10 @@ module ActionDispatch
107
107
  end
108
108
 
109
109
  {
110
- regexp_states: simple_regexp,
111
- string_states: @string_states,
112
- stdparam_states: @stdparam_states,
113
- accepting: @accepting
110
+ regexp_states: simple_regexp.stringify_keys,
111
+ string_states: @string_states.stringify_keys,
112
+ stdparam_states: @stdparam_states.stringify_keys,
113
+ accepting: @accepting.stringify_keys
114
114
  }
115
115
  end
116
116
 
@@ -65,7 +65,9 @@ module ActionDispatch
65
65
  content_type = Mime[:text]
66
66
  end
67
67
 
68
- if api_request?(content_type)
68
+ if request.head?
69
+ render(wrapper.status_code, "", content_type)
70
+ elsif api_request?(content_type)
69
71
  render_for_api_request(content_type, wrapper)
70
72
  else
71
73
  render_for_browser_request(request, wrapper)
@@ -18,8 +18,8 @@ module ActionDispatch
18
18
  "ActionController::UnknownFormat" => :not_acceptable,
19
19
  "ActionDispatch::Http::MimeNegotiation::InvalidType" => :not_acceptable,
20
20
  "ActionController::MissingExactTemplate" => :not_acceptable,
21
- "ActionController::InvalidAuthenticityToken" => :unprocessable_entity,
22
- "ActionController::InvalidCrossOriginRequest" => :unprocessable_entity,
21
+ "ActionController::InvalidAuthenticityToken" => ActionDispatch::Constants::UNPROCESSABLE_CONTENT,
22
+ "ActionController::InvalidCrossOriginRequest" => ActionDispatch::Constants::UNPROCESSABLE_CONTENT,
23
23
  "ActionDispatch::Http::Parameters::ParseError" => :bad_request,
24
24
  "ActionController::BadRequest" => :bad_request,
25
25
  "ActionController::ParameterMissing" => :bad_request,
@@ -173,7 +173,7 @@ module ActionDispatch
173
173
  end
174
174
 
175
175
  def self.status_code_for_exception(class_name)
176
- Rack::Utils.status_code(@@rescue_responses[class_name])
176
+ ActionDispatch::Response.rack_status_code(@@rescue_responses[class_name])
177
177
  end
178
178
 
179
179
  def show?(request)
@@ -21,8 +21,11 @@ module ActionDispatch
21
21
  end
22
22
 
23
23
  returned = response << ::Rack::BodyProxy.new(response.pop) { state.complete! }
24
- rescue => error
25
- @executor.error_reporter.report(error, handled: false, source: "application.action_dispatch")
24
+ rescue Exception => error
25
+ request = ActionDispatch::Request.new env
26
+ backtrace_cleaner = request.get_header("action_dispatch.backtrace_cleaner")
27
+ wrapper = ExceptionWrapper.new(backtrace_cleaner, error)
28
+ @executor.error_reporter.report(wrapper.unwrapped_exception, handled: false, source: "application.action_dispatch")
26
29
  raise
27
30
  ensure
28
31
  state.complete! unless returned
@@ -32,7 +32,11 @@ module ActionDispatch
32
32
  end
33
33
  body = { status: status, error: Rack::Utils::HTTP_STATUS_CODES.fetch(status, Rack::Utils::HTTP_STATUS_CODES[500]) }
34
34
 
35
- render(status, content_type, body)
35
+ if env["action_dispatch.original_request_method"] == "HEAD"
36
+ render_format(status, content_type, "")
37
+ else
38
+ render(status, content_type, body)
39
+ end
36
40
  end
37
41
 
38
42
  private
@@ -852,7 +852,7 @@ module ActionDispatch
852
852
  #
853
853
  # Takes same options as `Base#match` and `Resources#resources`.
854
854
  #
855
- # # route /posts (without the prefix /admin) to +Admin::PostsController+
855
+ # # route /posts (without the prefix /admin) to Admin::PostsController
856
856
  # scope module: "admin" do
857
857
  # resources :posts
858
858
  # end
@@ -862,7 +862,7 @@ module ActionDispatch
862
862
  # resources :posts
863
863
  # end
864
864
  #
865
- # # prefix the routing helper name: +sekret_posts_path+ instead of +posts_path+
865
+ # # prefix the routing helper name: sekret_posts_path instead of posts_path
866
866
  # scope as: "sekret" do
867
867
  # resources :posts
868
868
  # end
@@ -961,12 +961,12 @@ module ActionDispatch
961
961
  # resources :posts
962
962
  # end
963
963
  #
964
- # # maps to +Sekret::PostsController+ rather than +Admin::PostsController+
964
+ # # maps to Sekret::PostsController rather than Admin::PostsController
965
965
  # namespace :admin, module: "sekret" do
966
966
  # resources :posts
967
967
  # end
968
968
  #
969
- # # generates +sekret_posts_path+ rather than +admin_posts_path+
969
+ # # generates sekret_posts_path rather than admin_posts_path
970
970
  # namespace :admin, as: "sekret" do
971
971
  # resources :posts
972
972
  # end
@@ -1499,7 +1499,7 @@ module ActionDispatch
1499
1499
  #
1500
1500
  # ### Examples
1501
1501
  #
1502
- # # routes call +Admin::PostsController+
1502
+ # # routes call Admin::PostsController
1503
1503
  # resources :posts, module: "admin"
1504
1504
  #
1505
1505
  # # resource actions are at /admin/posts.
@@ -38,7 +38,7 @@ module ActionDispatch
38
38
 
39
39
  private
40
40
  def code_from_name(name)
41
- GENERIC_RESPONSE_CODES[name] || Rack::Utils.status_code(name)
41
+ GENERIC_RESPONSE_CODES[name] || ActionDispatch::Response.rack_status_code(name)
42
42
  end
43
43
 
44
44
  def name_from_code(code)
@@ -594,9 +594,8 @@ module ActionDispatch
594
594
  # end
595
595
  # end
596
596
  #
597
- # See the [request helpers documentation]
598
- # (rdoc-ref:ActionDispatch::Integration::RequestHelpers) for help
599
- # on how to use `get`, etc.
597
+ # See the [request helpers documentation](rdoc-ref:ActionDispatch::Integration::RequestHelpers)
598
+ # for help on how to use `get`, etc.
600
599
  #
601
600
  # ### Changing the request encoding
602
601
  #
@@ -3,6 +3,7 @@
3
3
  # :markup: markdown
4
4
 
5
5
  require "nokogiri"
6
+ require "action_dispatch/http/mime_type"
6
7
 
7
8
  module ActionDispatch
8
9
  class RequestEncoder # :nodoc:
@@ -15,9 +16,9 @@ module ActionDispatch
15
16
 
16
17
  @encoders = { identity: IdentityEncoder.new }
17
18
 
18
- attr_reader :response_parser
19
+ attr_reader :response_parser, :content_type
19
20
 
20
- def initialize(mime_name, param_encoder, response_parser)
21
+ def initialize(mime_name, param_encoder, response_parser, content_type)
21
22
  @mime = Mime[mime_name]
22
23
 
23
24
  unless @mime
@@ -27,10 +28,7 @@ module ActionDispatch
27
28
 
28
29
  @response_parser = response_parser || -> body { body }
29
30
  @param_encoder = param_encoder || :"to_#{@mime.symbol}".to_proc
30
- end
31
-
32
- def content_type
33
- @mime.to_s
31
+ @content_type = content_type || @mime.to_s
34
32
  end
35
33
 
36
34
  def accept_header
@@ -50,11 +48,13 @@ module ActionDispatch
50
48
  @encoders[name] || @encoders[:identity]
51
49
  end
52
50
 
53
- def self.register_encoder(mime_name, param_encoder: nil, response_parser: nil)
54
- @encoders[mime_name] = new(mime_name, param_encoder, response_parser)
51
+ def self.register_encoder(mime_name, param_encoder: nil, response_parser: nil, content_type: nil)
52
+ @encoders[mime_name] = new(mime_name, param_encoder, response_parser, content_type)
55
53
  end
56
54
 
57
- register_encoder :html, response_parser: -> body { Rails::Dom::Testing.html_document.parse(body) }
55
+ register_encoder :html, response_parser: -> body { Rails::Dom::Testing.html_document.parse(body) },
56
+ param_encoder: -> param { param },
57
+ content_type: Mime[:url_encoded_form].to_s
58
58
  register_encoder :json, response_parser: -> body { JSON.parse(body, object_class: ActiveSupport::HashWithIndifferentAccess) }
59
59
  end
60
60
  end
@@ -9,8 +9,7 @@ module ActionDispatch
9
9
  module TestProcess
10
10
  module FixtureFile
11
11
  # Shortcut for
12
- # `Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_f
13
- # ixture_path, path), type)`:
12
+ # `Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_fixture_path, path), type)`:
14
13
  #
15
14
  # post :change_avatar, params: { avatar: file_fixture_upload('david.png', 'image/png') }
16
15
  #
@@ -11,8 +11,8 @@ module ActionPack
11
11
  module VERSION
12
12
  MAJOR = 7
13
13
  MINOR = 2
14
- TINY = 2
15
- PRE = "2"
14
+ TINY = 3
15
+ PRE = nil
16
16
 
17
17
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.2.2
4
+ version: 7.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,14 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 7.2.2.2
18
+ version: 7.2.3
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 7.2.2.2
25
+ version: 7.2.3
26
+ - !ruby/object:Gem::Dependency
27
+ name: cgi
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
26
40
  - !ruby/object:Gem::Dependency
27
41
  name: nokogiri
28
42
  requirement: !ruby/object:Gem::Requirement
@@ -60,7 +74,7 @@ dependencies:
60
74
  version: 2.2.4
61
75
  - - "<"
62
76
  - !ruby/object:Gem::Version
63
- version: '3.2'
77
+ version: '3.3'
64
78
  type: :runtime
65
79
  prerelease: false
66
80
  version_requirements: !ruby/object:Gem::Requirement
@@ -70,7 +84,7 @@ dependencies:
70
84
  version: 2.2.4
71
85
  - - "<"
72
86
  - !ruby/object:Gem::Version
73
- version: '3.2'
87
+ version: '3.3'
74
88
  - !ruby/object:Gem::Dependency
75
89
  name: rack-session
76
90
  requirement: !ruby/object:Gem::Requirement
@@ -147,28 +161,28 @@ dependencies:
147
161
  requirements:
148
162
  - - '='
149
163
  - !ruby/object:Gem::Version
150
- version: 7.2.2.2
164
+ version: 7.2.3
151
165
  type: :runtime
152
166
  prerelease: false
153
167
  version_requirements: !ruby/object:Gem::Requirement
154
168
  requirements:
155
169
  - - '='
156
170
  - !ruby/object:Gem::Version
157
- version: 7.2.2.2
171
+ version: 7.2.3
158
172
  - !ruby/object:Gem::Dependency
159
173
  name: activemodel
160
174
  requirement: !ruby/object:Gem::Requirement
161
175
  requirements:
162
176
  - - '='
163
177
  - !ruby/object:Gem::Version
164
- version: 7.2.2.2
178
+ version: 7.2.3
165
179
  type: :development
166
180
  prerelease: false
167
181
  version_requirements: !ruby/object:Gem::Requirement
168
182
  requirements:
169
183
  - - '='
170
184
  - !ruby/object:Gem::Version
171
- version: 7.2.2.2
185
+ version: 7.2.3
172
186
  description: Web apps on Rails. Simple, battle-tested conventions for building and
173
187
  testing MVC web applications. Works with any Rack-compatible server.
174
188
  email: david@loudthinking.com
@@ -368,10 +382,10 @@ licenses:
368
382
  - MIT
369
383
  metadata:
370
384
  bug_tracker_uri: https://github.com/rails/rails/issues
371
- changelog_uri: https://github.com/rails/rails/blob/v7.2.2.2/actionpack/CHANGELOG.md
372
- documentation_uri: https://api.rubyonrails.org/v7.2.2.2/
385
+ changelog_uri: https://github.com/rails/rails/blob/v7.2.3/actionpack/CHANGELOG.md
386
+ documentation_uri: https://api.rubyonrails.org/v7.2.3/
373
387
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
374
- source_code_uri: https://github.com/rails/rails/tree/v7.2.2.2/actionpack
388
+ source_code_uri: https://github.com/rails/rails/tree/v7.2.3/actionpack
375
389
  rubygems_mfa_required: 'true'
376
390
  rdoc_options: []
377
391
  require_paths: