actionpack 5.2.0 → 6.1.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +408 -190
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +4 -3
  5. data/lib/abstract_controller/base.rb +38 -4
  6. data/lib/abstract_controller/caching/fragments.rb +6 -22
  7. data/lib/abstract_controller/caching.rb +1 -1
  8. data/lib/abstract_controller/callbacks.rb +14 -2
  9. data/lib/abstract_controller/collector.rb +1 -2
  10. data/lib/abstract_controller/helpers.rb +106 -90
  11. data/lib/abstract_controller/railties/routes_helpers.rb +17 -1
  12. data/lib/abstract_controller/rendering.rb +9 -9
  13. data/lib/abstract_controller/translation.rb +11 -5
  14. data/lib/abstract_controller.rb +2 -0
  15. data/lib/action_controller/api.rb +4 -3
  16. data/lib/action_controller/base.rb +6 -9
  17. data/lib/action_controller/caching.rb +1 -3
  18. data/lib/action_controller/log_subscriber.rb +10 -7
  19. data/lib/action_controller/metal/basic_implicit_render.rb +1 -1
  20. data/lib/action_controller/metal/conditional_get.rb +19 -5
  21. data/lib/action_controller/metal/content_security_policy.rb +1 -2
  22. data/lib/action_controller/metal/cookies.rb +3 -1
  23. data/lib/action_controller/metal/data_streaming.rb +6 -7
  24. data/lib/action_controller/metal/default_headers.rb +17 -0
  25. data/lib/action_controller/metal/etag_with_template_digest.rb +4 -6
  26. data/lib/action_controller/metal/exceptions.rb +56 -2
  27. data/lib/action_controller/metal/flash.rb +5 -5
  28. data/lib/action_controller/metal/head.rb +7 -4
  29. data/lib/action_controller/metal/helpers.rb +14 -5
  30. data/lib/action_controller/metal/http_authentication.rb +25 -24
  31. data/lib/action_controller/metal/implicit_render.rb +5 -15
  32. data/lib/action_controller/metal/instrumentation.rb +13 -14
  33. data/lib/action_controller/metal/live.rb +39 -32
  34. data/lib/action_controller/metal/logging.rb +20 -0
  35. data/lib/action_controller/metal/mime_responds.rb +19 -4
  36. data/lib/action_controller/metal/parameter_encoding.rb +35 -4
  37. data/lib/action_controller/metal/params_wrapper.rb +33 -23
  38. data/lib/action_controller/metal/permissions_policy.rb +46 -0
  39. data/lib/action_controller/metal/redirecting.rb +7 -7
  40. data/lib/action_controller/metal/renderers.rb +4 -4
  41. data/lib/action_controller/metal/rendering.rb +8 -3
  42. data/lib/action_controller/metal/request_forgery_protection.rb +89 -36
  43. data/lib/action_controller/metal/rescue.rb +1 -1
  44. data/lib/action_controller/metal/streaming.rb +0 -1
  45. data/lib/action_controller/metal/strong_parameters.rb +181 -69
  46. data/lib/action_controller/metal/url_for.rb +1 -1
  47. data/lib/action_controller/metal.rb +12 -10
  48. data/lib/action_controller/railties/helpers.rb +1 -1
  49. data/lib/action_controller/renderer.rb +37 -13
  50. data/lib/action_controller/template_assertions.rb +1 -1
  51. data/lib/action_controller/test_case.rb +81 -70
  52. data/lib/action_controller.rb +7 -4
  53. data/lib/action_dispatch/http/cache.rb +34 -28
  54. data/lib/action_dispatch/http/content_disposition.rb +45 -0
  55. data/lib/action_dispatch/http/content_security_policy.rb +47 -24
  56. data/lib/action_dispatch/http/filter_parameters.rb +9 -8
  57. data/lib/action_dispatch/http/filter_redirect.rb +2 -3
  58. data/lib/action_dispatch/http/headers.rb +4 -4
  59. data/lib/action_dispatch/http/mime_negotiation.rb +31 -13
  60. data/lib/action_dispatch/http/mime_type.rb +43 -24
  61. data/lib/action_dispatch/http/parameters.rb +14 -23
  62. data/lib/action_dispatch/http/permissions_policy.rb +173 -0
  63. data/lib/action_dispatch/http/request.rb +45 -22
  64. data/lib/action_dispatch/http/response.rb +45 -25
  65. data/lib/action_dispatch/http/upload.rb +9 -1
  66. data/lib/action_dispatch/http/url.rb +82 -82
  67. data/lib/action_dispatch/journey/formatter.rb +55 -31
  68. data/lib/action_dispatch/journey/gtg/builder.rb +22 -37
  69. data/lib/action_dispatch/journey/gtg/simulator.rb +8 -7
  70. data/lib/action_dispatch/journey/gtg/transition_table.rb +6 -5
  71. data/lib/action_dispatch/journey/nfa/dot.rb +0 -11
  72. data/lib/action_dispatch/journey/nodes/node.rb +13 -11
  73. data/lib/action_dispatch/journey/parser.rb +13 -13
  74. data/lib/action_dispatch/journey/parser.y +1 -1
  75. data/lib/action_dispatch/journey/path/pattern.rb +21 -22
  76. data/lib/action_dispatch/journey/route.rb +10 -20
  77. data/lib/action_dispatch/journey/router/utils.rb +14 -12
  78. data/lib/action_dispatch/journey/router.rb +26 -34
  79. data/lib/action_dispatch/journey/routes.rb +1 -2
  80. data/lib/action_dispatch/journey/scanner.rb +10 -4
  81. data/lib/action_dispatch/journey/visitors.rb +1 -4
  82. data/lib/action_dispatch/journey.rb +0 -2
  83. data/lib/action_dispatch/middleware/actionable_exceptions.rb +46 -0
  84. data/lib/action_dispatch/middleware/callbacks.rb +2 -4
  85. data/lib/action_dispatch/middleware/cookies.rb +128 -109
  86. data/lib/action_dispatch/middleware/debug_exceptions.rb +43 -66
  87. data/lib/action_dispatch/middleware/debug_locks.rb +5 -5
  88. data/lib/action_dispatch/middleware/debug_view.rb +66 -0
  89. data/lib/action_dispatch/middleware/exception_wrapper.rb +75 -30
  90. data/lib/action_dispatch/middleware/flash.rb +2 -2
  91. data/lib/action_dispatch/middleware/host_authorization.rb +130 -0
  92. data/lib/action_dispatch/middleware/public_exceptions.rb +6 -3
  93. data/lib/action_dispatch/middleware/remote_ip.rb +14 -16
  94. data/lib/action_dispatch/middleware/request_id.rb +5 -6
  95. data/lib/action_dispatch/middleware/session/abstract_store.rb +15 -2
  96. data/lib/action_dispatch/middleware/session/cache_store.rb +11 -6
  97. data/lib/action_dispatch/middleware/session/cookie_store.rb +24 -19
  98. data/lib/action_dispatch/middleware/show_exceptions.rb +3 -2
  99. data/lib/action_dispatch/middleware/ssl.rb +20 -15
  100. data/lib/action_dispatch/middleware/stack.rb +57 -3
  101. data/lib/action_dispatch/middleware/static.rb +153 -93
  102. data/lib/action_dispatch/middleware/templates/rescues/_actions.html.erb +13 -0
  103. data/lib/action_dispatch/middleware/templates/rescues/_actions.text.erb +0 -0
  104. data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +22 -0
  105. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +3 -1
  106. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +1 -1
  107. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +4 -2
  108. data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +45 -35
  109. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +7 -0
  110. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +5 -0
  111. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +23 -4
  112. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +1 -1
  113. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +6 -3
  114. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +4 -1
  115. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +104 -8
  116. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +19 -0
  117. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.text.erb +3 -0
  118. data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +2 -2
  119. data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +1 -1
  120. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +2 -2
  121. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +1 -1
  122. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +24 -1
  123. data/lib/action_dispatch/railtie.rb +8 -2
  124. data/lib/action_dispatch/request/session.rb +17 -10
  125. data/lib/action_dispatch/request/utils.rb +28 -2
  126. data/lib/action_dispatch/routing/inspector.rb +101 -53
  127. data/lib/action_dispatch/routing/mapper.rb +156 -103
  128. data/lib/action_dispatch/routing/polymorphic_routes.rb +21 -19
  129. data/lib/action_dispatch/routing/redirection.rb +4 -4
  130. data/lib/action_dispatch/routing/route_set.rb +71 -69
  131. data/lib/action_dispatch/routing/url_for.rb +3 -3
  132. data/lib/action_dispatch/routing.rb +21 -20
  133. data/lib/action_dispatch/system_test_case.rb +54 -11
  134. data/lib/action_dispatch/system_testing/browser.rb +53 -16
  135. data/lib/action_dispatch/system_testing/driver.rb +11 -3
  136. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +49 -7
  137. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +8 -6
  138. data/lib/action_dispatch/testing/assertion_response.rb +0 -1
  139. data/lib/action_dispatch/testing/assertions/response.rb +4 -7
  140. data/lib/action_dispatch/testing/assertions/routing.rb +20 -8
  141. data/lib/action_dispatch/testing/assertions.rb +1 -1
  142. data/lib/action_dispatch/testing/integration.rb +61 -28
  143. data/lib/action_dispatch/testing/request_encoder.rb +3 -3
  144. data/lib/action_dispatch/testing/test_process.rb +29 -4
  145. data/lib/action_dispatch/testing/test_request.rb +3 -3
  146. data/lib/action_dispatch/testing/test_response.rb +4 -32
  147. data/lib/action_dispatch.rb +14 -7
  148. data/lib/action_pack/gem_version.rb +3 -3
  149. data/lib/action_pack.rb +1 -1
  150. metadata +39 -22
  151. data/lib/action_controller/metal/force_ssl.rb +0 -99
  152. data/lib/action_dispatch/http/parameter_filter.rb +0 -86
  153. data/lib/action_dispatch/journey/nfa/builder.rb +0 -78
  154. data/lib/action_dispatch/journey/nfa/simulator.rb +0 -49
  155. data/lib/action_dispatch/journey/nfa/transition_table.rb +0 -120
  156. data/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb +0 -26
@@ -2,8 +2,6 @@
2
2
 
3
3
  require "stringio"
4
4
  require "uri"
5
- require "active_support/core_ext/kernel/singleton_class"
6
- require "active_support/core_ext/object/try"
7
5
  require "rack/test"
8
6
  require "minitest"
9
7
 
@@ -44,16 +42,33 @@ module ActionDispatch
44
42
 
45
43
  # Performs a HEAD request with the given parameters. See ActionDispatch::Integration::Session#process
46
44
  # for more details.
47
- def head(path, *args)
48
- process(:head, path, *args)
45
+ def head(path, **args)
46
+ process(:head, path, **args)
47
+ end
48
+
49
+ # Performs an OPTIONS request with the given parameters. See ActionDispatch::Integration::Session#process
50
+ # for more details.
51
+ def options(path, **args)
52
+ process(:options, path, **args)
49
53
  end
50
54
 
51
55
  # Follow a single redirect response. If the last response was not a
52
56
  # redirect, an exception will be raised. Otherwise, the redirect is
53
- # performed on the location header.
54
- def follow_redirect!
57
+ # performed on the location header. If the redirection is a 307 or 308 redirect,
58
+ # the same HTTP verb will be used when redirecting, otherwise a GET request
59
+ # will be performed. Any arguments are passed to the
60
+ # underlying request.
61
+ def follow_redirect!(**args)
55
62
  raise "not a redirect! #{status} #{status_message}" unless redirect?
56
- get(response.location)
63
+
64
+ method =
65
+ if [307, 308].include?(response.status)
66
+ request.method.downcase
67
+ else
68
+ :get
69
+ end
70
+
71
+ public_send(method, response.location, **args)
57
72
  status
58
73
  end
59
74
  end
@@ -72,13 +87,8 @@ module ActionDispatch
72
87
  include Minitest::Assertions
73
88
  include TestProcess, RequestHelpers, Assertions
74
89
 
75
- %w( status status_message headers body redirect? ).each do |method|
76
- delegate method, to: :response, allow_nil: true
77
- end
78
-
79
- %w( path ).each do |method|
80
- delegate method, to: :request, allow_nil: true
81
- end
90
+ delegate :status, :status_message, :headers, :body, :redirect?, to: :response, allow_nil: true
91
+ delegate :path, to: :request, allow_nil: true
82
92
 
83
93
  # The hostname used in the last request.
84
94
  def host
@@ -122,7 +132,7 @@ module ActionDispatch
122
132
 
123
133
  def url_options
124
134
  @url_options ||= default_url_options.dup.tap do |url_options|
125
- url_options.reverse_merge!(controller.url_options) if controller
135
+ url_options.reverse_merge!(controller.url_options) if controller.respond_to?(:url_options)
126
136
 
127
137
  if @app.respond_to?(:routes)
128
138
  url_options.reverse_merge!(@app.routes.default_url_options)
@@ -189,6 +199,12 @@ module ActionDispatch
189
199
  # merged into the Rack env hash.
190
200
  # - +env+: Additional env to pass, as a Hash. The headers will be
191
201
  # merged into the Rack env hash.
202
+ # - +xhr+: Set to +true+ if you want to make and Ajax request.
203
+ # Adds request headers characteristic of XMLHttpRequest e.g. HTTP_X_REQUESTED_WITH.
204
+ # The headers will be merged into the Rack env hash.
205
+ # - +as+: Used for encoding the request with different content type.
206
+ # Supports +:json+ by default and will set the appropriate request headers.
207
+ # The headers will be merged into the Rack env hash.
192
208
  #
193
209
  # This method is rarely used directly. Use +#get+, +#post+, or other standard
194
210
  # HTTP methods in integration tests. +#process+ is only required when using a
@@ -210,7 +226,7 @@ module ActionDispatch
210
226
  method = :post
211
227
  end
212
228
 
213
- if path =~ %r{://}
229
+ if %r{://}.match?(path)
214
230
  path = build_expanded_path(path) do |location|
215
231
  https! URI::HTTPS === location if location.scheme
216
232
 
@@ -303,6 +319,7 @@ module ActionDispatch
303
319
  APP_SESSIONS = {}
304
320
 
305
321
  attr_reader :app
322
+ attr_accessor :root_session # :nodoc:
306
323
 
307
324
  def initialize(*args, &blk)
308
325
  super(*args, &blk)
@@ -328,7 +345,7 @@ module ActionDispatch
328
345
  klass = APP_SESSIONS[app] ||= Class.new(Integration::Session) {
329
346
  # If the app is a Rails app, make url_helpers available on the session.
330
347
  # This makes app.url_for and app.foo_path available in the console.
331
- if app.respond_to?(:routes)
348
+ if app.respond_to?(:routes) && app.routes.is_a?(ActionDispatch::Routing::RouteSet)
332
349
  include app.routes.url_helpers
333
350
  include app.routes.mounted_helpers
334
351
  end
@@ -341,16 +358,22 @@ module ActionDispatch
341
358
  end
342
359
 
343
360
  %w(get post patch put head delete cookies assigns follow_redirect!).each do |method|
344
- define_method(method) do |*args|
345
- # reset the html_document variable, except for cookies/assigns calls
346
- unless method == "cookies" || method == "assigns"
347
- @html_document = nil
348
- end
361
+ # reset the html_document variable, except for cookies/assigns calls
362
+ unless method == "cookies" || method == "assigns"
363
+ reset_html_document = "@html_document = nil"
364
+ end
365
+
366
+ definition = RUBY_VERSION >= "2.7" ? "..." : "*args"
367
+
368
+ module_eval <<~RUBY, __FILE__, __LINE__ + 1
369
+ def #{method}(#{definition})
370
+ #{reset_html_document}
349
371
 
350
- integration_session.__send__(method, *args).tap do
372
+ result = integration_session.#{method}(#{definition})
351
373
  copy_session_variables!
374
+ result
352
375
  end
353
- end
376
+ RUBY
354
377
  end
355
378
 
356
379
  # Open a new session instance. If a block is given, the new session is
@@ -366,10 +389,19 @@ module ActionDispatch
366
389
  def open_session
367
390
  dup.tap do |session|
368
391
  session.reset!
392
+ session.root_session = self.root_session || self
369
393
  yield session if block_given?
370
394
  end
371
395
  end
372
396
 
397
+ def assertions # :nodoc:
398
+ root_session ? root_session.assertions : super
399
+ end
400
+
401
+ def assertions=(assertions) # :nodoc:
402
+ root_session ? root_session.assertions = assertions : super
403
+ end
404
+
373
405
  # Copy the instance variables from the current session instance into the
374
406
  # test instance.
375
407
  def copy_session_variables! #:nodoc:
@@ -401,6 +433,7 @@ module ActionDispatch
401
433
  super
402
434
  end
403
435
  end
436
+ ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
404
437
  end
405
438
  end
406
439
 
@@ -484,7 +517,7 @@ module ActionDispatch
484
517
  #
485
518
  # A simple integration test that exercises multiple controllers:
486
519
  #
487
- # require 'test_helper'
520
+ # require "test_helper"
488
521
  #
489
522
  # class UserFlowsTest < ActionDispatch::IntegrationTest
490
523
  # test "login and browse site" do
@@ -513,7 +546,7 @@ module ActionDispatch
513
546
  #
514
547
  # Here's an example of multiple sessions and custom DSL in an integration test
515
548
  #
516
- # require 'test_helper'
549
+ # require "test_helper"
517
550
  #
518
551
  # class UserFlowsTest < ActionDispatch::IntegrationTest
519
552
  # test "login and browse site" do
@@ -633,8 +666,8 @@ module ActionDispatch
633
666
  @@app = app
634
667
  end
635
668
 
636
- def register_encoder(*args)
637
- RequestEncoder.register_encoder(*args)
669
+ def register_encoder(*args, **options)
670
+ RequestEncoder.register_encoder(*args, **options)
638
671
  end
639
672
  end
640
673
 
@@ -34,12 +34,12 @@ module ActionDispatch
34
34
  end
35
35
 
36
36
  def encode_params(params)
37
- @param_encoder.call(params)
37
+ @param_encoder.call(params) if params
38
38
  end
39
39
 
40
40
  def self.parser(content_type)
41
- mime = Mime::Type.lookup(content_type)
42
- encoder(mime ? mime.ref : nil).response_parser
41
+ type = Mime::Type.lookup(content_type).ref if content_type
42
+ encoder(type).response_parser
43
43
  end
44
44
 
45
45
  def self.encoder(name)
@@ -6,19 +6,44 @@ require "action_dispatch/middleware/flash"
6
6
  module ActionDispatch
7
7
  module TestProcess
8
8
  module FixtureFile
9
- # Shortcut for <tt>Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.fixture_path, path), type)</tt>:
9
+ # Shortcut for <tt>Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_fixture_path, path), type)</tt>:
10
10
  #
11
- # post :change_avatar, avatar: fixture_file_upload('files/spongebob.png', 'image/png')
11
+ # post :change_avatar, params: { avatar: fixture_file_upload('spongebob.png', 'image/png') }
12
+ #
13
+ # Default fixture files location is <tt>test/fixtures/files</tt>.
12
14
  #
13
15
  # To upload binary files on Windows, pass <tt>:binary</tt> as the last parameter.
14
16
  # This will not affect other platforms:
15
17
  #
16
- # post :change_avatar, avatar: fixture_file_upload('files/spongebob.png', 'image/png', :binary)
18
+ # post :change_avatar, params: { avatar: fixture_file_upload('spongebob.png', 'image/png', :binary) }
17
19
  def fixture_file_upload(path, mime_type = nil, binary = false)
18
20
  if self.class.respond_to?(:fixture_path) && self.class.fixture_path &&
19
21
  !File.exist?(path)
20
- path = File.join(self.class.fixture_path, path)
22
+ original_path = path
23
+ path = Pathname.new(self.class.fixture_path).join(path)
24
+
25
+ if !self.class.file_fixture_path
26
+ ActiveSupport::Deprecation.warn(<<~EOM)
27
+ Passing a path to `fixture_file_upload` relative to `fixture_path` is deprecated.
28
+ In Rails 6.2, the path needs to be relative to `file_fixture_path` which you
29
+ haven't set yet. Set `file_fixture_path` to discard this warning.
30
+ EOM
31
+ elsif path.exist?
32
+ non_deprecated_path = Pathname(File.absolute_path(path)).relative_path_from(Pathname(File.absolute_path(self.class.file_fixture_path)))
33
+ ActiveSupport::Deprecation.warn(<<~EOM)
34
+ Passing a path to `fixture_file_upload` relative to `fixture_path` is deprecated.
35
+ In Rails 6.2, the path needs to be relative to `file_fixture_path`.
36
+
37
+ Please modify the call from
38
+ `fixture_file_upload("#{original_path}")` to `fixture_file_upload("#{non_deprecated_path}")`.
39
+ EOM
40
+ else
41
+ path = file_fixture(original_path)
42
+ end
43
+ elsif self.class.file_fixture_path && !File.exist?(path)
44
+ path = file_fixture(path)
21
45
  end
46
+
22
47
  Rack::Test::UploadedFile.new(path, mime_type, binary)
23
48
  end
24
49
  end
@@ -6,9 +6,9 @@ require "rack/utils"
6
6
  module ActionDispatch
7
7
  class TestRequest < Request
8
8
  DEFAULT_ENV = Rack::MockRequest.env_for("/",
9
- "HTTP_HOST" => "test.host",
10
- "REMOTE_ADDR" => "0.0.0.0",
11
- "HTTP_USER_AGENT" => "Rails Testing",
9
+ "HTTP_HOST" => "test.host".b,
10
+ "REMOTE_ADDR" => "0.0.0.0".b,
11
+ "HTTP_USER_AGENT" => "Rails Testing".b,
12
12
  )
13
13
 
14
14
  # Create a new test request with default +env+ values.
@@ -14,40 +14,12 @@ module ActionDispatch
14
14
  new response.status, response.headers, response.body
15
15
  end
16
16
 
17
- def initialize(*) # :nodoc:
18
- super
19
- @response_parser = RequestEncoder.parser(content_type)
20
- end
21
-
22
- # Was the response successful?
23
- def success?
24
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
25
- The success? predicate is deprecated and will be removed in Rails 6.0.
26
- Please use successful? as provided by Rack::Response::Helpers.
27
- MSG
28
- successful?
29
- end
30
-
31
- # Was the URL not found?
32
- def missing?
33
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
34
- The missing? predicate is deprecated and will be removed in Rails 6.0.
35
- Please use not_found? as provided by Rack::Response::Helpers.
36
- MSG
37
- not_found?
38
- end
39
-
40
- # Was there a server-side error?
41
- def error?
42
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
43
- The error? predicate is deprecated and will be removed in Rails 6.0.
44
- Please use server_error? as provided by Rack::Response::Helpers.
45
- MSG
46
- server_error?
17
+ def parsed_body
18
+ @parsed_body ||= response_parser.call(body)
47
19
  end
48
20
 
49
- def parsed_body
50
- @parsed_body ||= @response_parser.call(body)
21
+ def response_parser
22
+ @response_parser ||= RequestEncoder.parser(media_type)
51
23
  end
52
24
  end
53
25
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright (c) 2004-2018 David Heinemeier Hansson
4
+ # Copyright (c) 2004-2020 David Heinemeier Hansson
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining
7
7
  # a copy of this software and associated documentation files (the
@@ -40,20 +40,27 @@ module ActionDispatch
40
40
  class IllegalStateError < StandardError
41
41
  end
42
42
 
43
+ class MissingController < NameError
44
+ end
45
+
43
46
  eager_autoload do
44
47
  autoload_under "http" do
45
48
  autoload :ContentSecurityPolicy
49
+ autoload :PermissionsPolicy
46
50
  autoload :Request
47
51
  autoload :Response
48
52
  end
49
53
  end
50
54
 
51
55
  autoload_under "middleware" do
56
+ autoload :HostAuthorization
52
57
  autoload :RequestId
53
58
  autoload :Callbacks
54
59
  autoload :Cookies
60
+ autoload :ActionableExceptions
55
61
  autoload :DebugExceptions
56
62
  autoload :DebugLocks
63
+ autoload :DebugView
57
64
  autoload :ExceptionWrapper
58
65
  autoload :Executor
59
66
  autoload :Flash
@@ -76,17 +83,16 @@ module ActionDispatch
76
83
  autoload :Headers
77
84
  autoload :MimeNegotiation
78
85
  autoload :Parameters
79
- autoload :ParameterFilter
80
- autoload :Upload
81
86
  autoload :UploadedFile, "action_dispatch/http/upload"
82
87
  autoload :URL
83
88
  end
84
89
 
85
90
  module Session
86
- autoload :AbstractStore, "action_dispatch/middleware/session/abstract_store"
87
- autoload :CookieStore, "action_dispatch/middleware/session/cookie_store"
88
- autoload :MemCacheStore, "action_dispatch/middleware/session/mem_cache_store"
89
- autoload :CacheStore, "action_dispatch/middleware/session/cache_store"
91
+ autoload :AbstractStore, "action_dispatch/middleware/session/abstract_store"
92
+ autoload :AbstractSecureStore, "action_dispatch/middleware/session/abstract_store"
93
+ autoload :CookieStore, "action_dispatch/middleware/session/cookie_store"
94
+ autoload :MemCacheStore, "action_dispatch/middleware/session/mem_cache_store"
95
+ autoload :CacheStore, "action_dispatch/middleware/session/cache_store"
90
96
  end
91
97
 
92
98
  mattr_accessor :test_app
@@ -109,4 +115,5 @@ autoload :Mime, "action_dispatch/http/mime_type"
109
115
  ActiveSupport.on_load(:action_view) do
110
116
  ActionView::Base.default_formats ||= Mime::SET.symbols
111
117
  ActionView::Template::Types.delegate_to Mime
118
+ ActionView::LookupContext::DetailsKey.clear
112
119
  end
@@ -7,9 +7,9 @@ module ActionPack
7
7
  end
8
8
 
9
9
  module VERSION
10
- MAJOR = 5
11
- MINOR = 2
12
- TINY = 0
10
+ MAJOR = 6
11
+ MINOR = 1
12
+ TINY = 4
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
data/lib/action_pack.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright (c) 2004-2018 David Heinemeier Hansson
4
+ # Copyright (c) 2004-2020 David Heinemeier Hansson
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining
7
7
  # a copy of this software and associated documentation files (the
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 6.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-09 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.0
19
+ version: 6.1.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.0
26
+ version: 6.1.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 2.0.9
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
43
  version: '2.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.9
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rack-test
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +67,7 @@ dependencies:
61
67
  version: '1.0'
62
68
  - - ">="
63
69
  - !ruby/object:Gem::Version
64
- version: 1.0.2
70
+ version: 1.2.0
65
71
  type: :runtime
66
72
  prerelease: false
67
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,7 +77,7 @@ dependencies:
71
77
  version: '1.0'
72
78
  - - ">="
73
79
  - !ruby/object:Gem::Version
74
- version: 1.0.2
80
+ version: 1.2.0
75
81
  - !ruby/object:Gem::Dependency
76
82
  name: rails-dom-testing
77
83
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +98,28 @@ dependencies:
92
98
  requirements:
93
99
  - - '='
94
100
  - !ruby/object:Gem::Version
95
- version: 5.2.0
101
+ version: 6.1.4
96
102
  type: :runtime
97
103
  prerelease: false
98
104
  version_requirements: !ruby/object:Gem::Requirement
99
105
  requirements:
100
106
  - - '='
101
107
  - !ruby/object:Gem::Version
102
- version: 5.2.0
108
+ version: 6.1.4
103
109
  - !ruby/object:Gem::Dependency
104
110
  name: activemodel
105
111
  requirement: !ruby/object:Gem::Requirement
106
112
  requirements:
107
113
  - - '='
108
114
  - !ruby/object:Gem::Version
109
- version: 5.2.0
115
+ version: 6.1.4
110
116
  type: :development
111
117
  prerelease: false
112
118
  version_requirements: !ruby/object:Gem::Requirement
113
119
  requirements:
114
120
  - - '='
115
121
  - !ruby/object:Gem::Version
116
- version: 5.2.0
122
+ version: 6.1.4
117
123
  description: Web apps on Rails. Simple, battle-tested conventions for building and
118
124
  testing MVC web applications. Works with any Rack-compatible server.
119
125
  email: david@loudthinking.com
@@ -151,20 +157,22 @@ files:
151
157
  - lib/action_controller/metal/content_security_policy.rb
152
158
  - lib/action_controller/metal/cookies.rb
153
159
  - lib/action_controller/metal/data_streaming.rb
160
+ - lib/action_controller/metal/default_headers.rb
154
161
  - lib/action_controller/metal/etag_with_flash.rb
155
162
  - lib/action_controller/metal/etag_with_template_digest.rb
156
163
  - lib/action_controller/metal/exceptions.rb
157
164
  - lib/action_controller/metal/flash.rb
158
- - lib/action_controller/metal/force_ssl.rb
159
165
  - lib/action_controller/metal/head.rb
160
166
  - lib/action_controller/metal/helpers.rb
161
167
  - lib/action_controller/metal/http_authentication.rb
162
168
  - lib/action_controller/metal/implicit_render.rb
163
169
  - lib/action_controller/metal/instrumentation.rb
164
170
  - lib/action_controller/metal/live.rb
171
+ - lib/action_controller/metal/logging.rb
165
172
  - lib/action_controller/metal/mime_responds.rb
166
173
  - lib/action_controller/metal/parameter_encoding.rb
167
174
  - lib/action_controller/metal/params_wrapper.rb
175
+ - lib/action_controller/metal/permissions_policy.rb
168
176
  - lib/action_controller/metal/redirecting.rb
169
177
  - lib/action_controller/metal/renderers.rb
170
178
  - lib/action_controller/metal/rendering.rb
@@ -181,6 +189,7 @@ files:
181
189
  - lib/action_controller/test_case.rb
182
190
  - lib/action_dispatch.rb
183
191
  - lib/action_dispatch/http/cache.rb
192
+ - lib/action_dispatch/http/content_disposition.rb
184
193
  - lib/action_dispatch/http/content_security_policy.rb
185
194
  - lib/action_dispatch/http/filter_parameters.rb
186
195
  - lib/action_dispatch/http/filter_redirect.rb
@@ -188,8 +197,8 @@ files:
188
197
  - lib/action_dispatch/http/mime_negotiation.rb
189
198
  - lib/action_dispatch/http/mime_type.rb
190
199
  - lib/action_dispatch/http/mime_types.rb
191
- - lib/action_dispatch/http/parameter_filter.rb
192
200
  - lib/action_dispatch/http/parameters.rb
201
+ - lib/action_dispatch/http/permissions_policy.rb
193
202
  - lib/action_dispatch/http/rack_cache.rb
194
203
  - lib/action_dispatch/http/request.rb
195
204
  - lib/action_dispatch/http/response.rb
@@ -200,10 +209,7 @@ files:
200
209
  - lib/action_dispatch/journey/gtg/builder.rb
201
210
  - lib/action_dispatch/journey/gtg/simulator.rb
202
211
  - lib/action_dispatch/journey/gtg/transition_table.rb
203
- - lib/action_dispatch/journey/nfa/builder.rb
204
212
  - lib/action_dispatch/journey/nfa/dot.rb
205
- - lib/action_dispatch/journey/nfa/simulator.rb
206
- - lib/action_dispatch/journey/nfa/transition_table.rb
207
213
  - lib/action_dispatch/journey/nodes/node.rb
208
214
  - lib/action_dispatch/journey/parser.rb
209
215
  - lib/action_dispatch/journey/parser.y
@@ -218,13 +224,16 @@ files:
218
224
  - lib/action_dispatch/journey/visualizer/fsm.css
219
225
  - lib/action_dispatch/journey/visualizer/fsm.js
220
226
  - lib/action_dispatch/journey/visualizer/index.html.erb
227
+ - lib/action_dispatch/middleware/actionable_exceptions.rb
221
228
  - lib/action_dispatch/middleware/callbacks.rb
222
229
  - lib/action_dispatch/middleware/cookies.rb
223
230
  - lib/action_dispatch/middleware/debug_exceptions.rb
224
231
  - lib/action_dispatch/middleware/debug_locks.rb
232
+ - lib/action_dispatch/middleware/debug_view.rb
225
233
  - lib/action_dispatch/middleware/exception_wrapper.rb
226
234
  - lib/action_dispatch/middleware/executor.rb
227
235
  - lib/action_dispatch/middleware/flash.rb
236
+ - lib/action_dispatch/middleware/host_authorization.rb
228
237
  - lib/action_dispatch/middleware/public_exceptions.rb
229
238
  - lib/action_dispatch/middleware/reloader.rb
230
239
  - lib/action_dispatch/middleware/remote_ip.rb
@@ -237,17 +246,24 @@ files:
237
246
  - lib/action_dispatch/middleware/ssl.rb
238
247
  - lib/action_dispatch/middleware/stack.rb
239
248
  - lib/action_dispatch/middleware/static.rb
249
+ - lib/action_dispatch/middleware/templates/rescues/_actions.html.erb
250
+ - lib/action_dispatch/middleware/templates/rescues/_actions.text.erb
251
+ - lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb
240
252
  - lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
241
253
  - lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb
242
254
  - lib/action_dispatch/middleware/templates/rescues/_source.html.erb
243
255
  - lib/action_dispatch/middleware/templates/rescues/_source.text.erb
244
256
  - lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
245
257
  - lib/action_dispatch/middleware/templates/rescues/_trace.text.erb
258
+ - lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb
259
+ - lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb
246
260
  - lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb
247
261
  - lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb
248
262
  - lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb
249
263
  - lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb
250
264
  - lib/action_dispatch/middleware/templates/rescues/layout.erb
265
+ - lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb
266
+ - lib/action_dispatch/middleware/templates/rescues/missing_exact_template.text.erb
251
267
  - lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb
252
268
  - lib/action_dispatch/middleware/templates/rescues/missing_template.text.erb
253
269
  - lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb
@@ -276,7 +292,6 @@ files:
276
292
  - lib/action_dispatch/system_testing/server.rb
277
293
  - lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb
278
294
  - lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb
279
- - lib/action_dispatch/system_testing/test_helpers/undef_methods.rb
280
295
  - lib/action_dispatch/testing/assertion_response.rb
281
296
  - lib/action_dispatch/testing/assertions.rb
282
297
  - lib/action_dispatch/testing/assertions/response.rb
@@ -289,12 +304,15 @@ files:
289
304
  - lib/action_pack.rb
290
305
  - lib/action_pack/gem_version.rb
291
306
  - lib/action_pack/version.rb
292
- homepage: http://rubyonrails.org
307
+ homepage: https://rubyonrails.org
293
308
  licenses:
294
309
  - MIT
295
310
  metadata:
296
- source_code_uri: https://github.com/rails/rails/tree/v5.2.0/actionpack
297
- changelog_uri: https://github.com/rails/rails/blob/v5.2.0/actionpack/CHANGELOG.md
311
+ bug_tracker_uri: https://github.com/rails/rails/issues
312
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.4/actionpack/CHANGELOG.md
313
+ documentation_uri: https://api.rubyonrails.org/v6.1.4/
314
+ mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
315
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.4/actionpack
298
316
  post_install_message:
299
317
  rdoc_options: []
300
318
  require_paths:
@@ -303,7 +321,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
303
321
  requirements:
304
322
  - - ">="
305
323
  - !ruby/object:Gem::Version
306
- version: 2.2.2
324
+ version: 2.5.0
307
325
  required_rubygems_version: !ruby/object:Gem::Requirement
308
326
  requirements:
309
327
  - - ">="
@@ -311,8 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
329
  version: '0'
312
330
  requirements:
313
331
  - none
314
- rubyforge_project:
315
- rubygems_version: 2.7.6
332
+ rubygems_version: 3.1.2
316
333
  signing_key:
317
334
  specification_version: 4
318
335
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).