Commit Graph

16010 Commits

Author SHA1 Message Date
Jean Boussier
194ce13228 More AC::RateLimiting documentation fixes 2024-01-17 18:01:22 +01:00
Jean Boussier
10a34b7621 Touch up the AC::RateLimiting documentation 2024-01-17 17:59:49 +01:00
Jean Boussier
d839ddb71a Refactor ActionController::RateLimiting to use AS::Cache
Given that the limiter implementation provided by Kredis is a simple
increment with a limit, all `ActiveSupport::Cache` already provide that
same capability, with a wide range of backing stores, and not just Redis.

This even allow to use SolidCache has a backend if you so desire.

If we feel particularly fancy, we could also accept a more generic
limiter interface to better allow users to swap the implementation
for better algorithms such as leaky-bucket etc.
2024-01-17 15:40:49 +01:00
Eugene Kenny
0656787be6
Merge pull request #50764 from eugeneius/syntax_error_proxy_nil_backtrace_locations
Handle nil backtrace_locations in SyntaxErrorProxy
2024-01-16 14:20:13 +00:00
Jean Boussier
946e46ebcc Modernize method missing implementations
`...` is both simpler an more correct since the keyword argument
separation.
2024-01-16 13:17:45 +01:00
Eugene Kenny
16d1351a93 Handle nil backtrace_locations in SyntaxErrorProxy 2024-01-16 01:05:53 +00:00
Rafael Mendonça França
a39332fa45
Remove code duplication and improve message 2024-01-15 22:29:46 +00:00
Hartley McGuire
0821d25d56
Add custom ArgumentError for invalid to: values
Previously, it was theoretically possible to define a route with a
Symbol as a `to:` value (or at least, it would not raise a
`NoMethodError`). However, passing a Symbol broke when `/#/.match?(to)`
was [replaced][1] with `to&.include?("#")` with the assumption that `to`
was always a String.

Instead of restoring the previous error, this commit improves how the
`to:` value is checked so that it raises an `ArgumentError` for any
invalid values. The extra strictness will specifically improve the error
when a Symbol or String that doesn't include a "#" are passed since they
were effectively equivalent to passing a `nil` value, or not specifying
`to:` at all.

[1]: 5726b1d1d7665c33830ad114f45258ecf772b7b6
2024-01-15 22:29:45 +00:00
Jean Boussier
2d6b02bad6
Merge pull request #50632 from skipkayhil/hm-move-chunk-test-to-actionpack
Move Transfer-Encoding chunked test to Action Pack
2024-01-09 14:35:50 +01:00
Rafael Mendonça França
84f773f9d1
Merge pull request #50622 from seanpdoyle/document-render-in-examples
Document rendering `:renderable` and `#render_in`
2024-01-08 16:51:39 -05:00
Rafael Mendonça França
b6a0fd8087
Merge pull request #50627 from koya1616/delete-fixed-FIXME
Delete FIXME annotation in dispatch/mapper_test.rb
2024-01-08 12:17:17 -05:00
Dwight Watson
e358953660 Add missing & 2024-01-08 16:19:19 +11:00
Jonathan Hefner
3bbf21c343 Use verb form of "fallback"
"Fallback" is a noun, whereas "fall back" is a verb.
2024-01-07 17:27:23 -06:00
Jonathan Hefner
ff9b62417f Prepend $ to example CLI commands [ci-skip]
This allows the syntax highlighter to recognize the code as CLI commands.
2024-01-07 17:27:23 -06:00
Hartley McGuire
a03a854193
Move Transfer-Encoding chunked test to Action Pack
While working on [another PR][1], I found that removing the
Transfer-Encoding conditionals did not result in any failing tests in
Action Pack. This was surprising to me until I found that there was a
test for this behavior in Railties. However, nothing about the test
really depends on having a full Rails application or the Railties test
suite.

This commit moves the test into Action Pack to simplify/speedup the test
(no need to build a full app) as well as keeping the test closer to the
actual behavior being tested.

[1]: 0c334b48fdc5d70b0c8406ba184fbfd26750b049
2024-01-07 14:33:25 -05:00
Hartley McGuire
580e1d621a
Fix links to master branches renamed to main
We recently had [two][1] [PRs][2] to update these types of links, so
this commit does all of the rest (remaining links to master branches
were checked and still exist).

[1]: e76c52a939dd7312fb9fd22b08e13496dc5c961e
[2]: a2ed3437e3be1e4dee4d1dac3c51a3b8742044ff
2024-01-07 12:35:46 -05:00
koya1616
6fe2221225 Delete FIXME annotation in dispatch/mapper_test.rb
Delete `FIXME` in `actionpack/test/dispatch/mapper_test.rb` because it's fixed.
2024-01-07 21:43:41 +09:00
Sean Doyle
4117583e4b Document rendering :renderable and #render_in
Provide examples for rendering objects that respond to `render_in`. Also
highlight that the object can also define a `#format` method to control
how the rendered String should be treated.

Add test coverage for both Action View's and Action Pack's support for
`render` with `:renderable` options.
2024-01-06 17:57:02 -05:00
Jean Boussier
27140247c2 Cleanup defined? usage
Now that we dropped support for Ruby 2.7, we no longer
need to check if variables are defined before accessing them
to avoid the undefined variable warning.
2024-01-05 15:05:35 +01:00
Jean Boussier
ef65e5fb32 Cleanup usage of ruby2_keywords
Now that we no longer support Ruby 2.7, many `ruby2_keyword` calls
can be eliminated.

The ones that are left could be eliminated but would end up substantially
slower or more compliacated so I left them for now.
2024-01-05 14:40:18 +01:00
Rafael Mendonça França
8b4e92f4be
Point rubocop to ruby 3.1 2024-01-03 19:02:32 +00:00
Rafael Mendonça França
9d18dc8505
Remove all code to work with Ruby < 3.1 2024-01-03 19:02:31 +00:00
Petrik de Heus
1ea796d6a8
Merge pull request #50523 from bparanj/correct-usage-of-named-routes
Document correct usage of named routes [skip ci]
2024-01-03 08:16:09 +01:00
Bala Paranj
74ad7356e2 Document correct usage of named routes [skip ci] 2024-01-02 21:27:54 -05:00
Hartley McGuire
90da071bb6
bundle update rubocop --conservative (#50515)
Also perform two autocorrects with `bundle exec rubocop -A`:

- fixes a new case of [`Style/RedundantReturn`][1]
- fixes a new case of [`Performance/StringInclude`][2]

[1]: 146b1c2e3389bc70ea0b54abf7843fc1d6c8cd5f
[2]: 3158bbb9f6454dce64dd0b4e2a548351d014c48f

Co-authored-by: David Heinemeier Hansson <david@basecamp.com>
2024-01-02 12:49:36 +01:00
zzak
2016c664b8
✂️ cut trailing whitespace 2024-01-01 09:20:27 +09:00
Vipul A M
5d56bb8777
Add changelog entry for #50505 [ci skip] (#50513) 2024-01-01 01:06:13 +01:00
David Heinemeier Hansson
e3da4fc53d
Add allow_browser to set minimum versions for your application (#50505)
* Add allow_browser to set minimum versions for your application
2023-12-31 19:19:16 +01:00
Jonathan Hefner
fe39741382
Merge pull request #50500 from matthieuprat/fix-typos
Fix a couple of typos [ci-skip]
2023-12-31 09:14:03 -06:00
David Heinemeier Hansson
179b979ddb
Add rate limiting to Action Controller via the Kredis limiter type (#50490)
* Add rate limiting via the Kredis limiter type
2023-12-31 13:26:01 +01:00
Matthieu Prat
070487e09e
Fix a couple of typos [ci skip] 2023-12-31 12:28:30 +01:00
Jean Boussier
6ba2fdb2fe Bump the required Ruby version to 3.1.0
Until now, Rails only droped compatibility with older
rubies on new majors, but I propose to change this policy
because it causes us to either keep compatibility with long
EOLed rubies or to bump the Rails major more often, and to
drop multiple Ruby versions at once when we bump the major.

In my opinion it's a bad alignments of incentives. And we'd
be much better to just drop support in new minors whenever they
go EOL (so 3 years).

Also Ruby being an upstream dependency, it's not even
a semver violation AFAICT.

Since Rails 7.2 isn't planned before a few months, we
can already drop Ruby 3.0 as it will be EOL in March.
2023-12-31 08:54:03 +01:00
Jonathan Hefner
76c26135b9 Fix inclusion of url_helpers module in concern
Follow-up to #46530.

The dynamically generated `url_helpers` module is an
`ActiveSupport::Concern`.  Therefore, when it is included directly in
another `ActiveSupport::Concern`, its `included` block is deferred until
the latter concern is itself included elsewhere.  Thus, in that case,
the call to `base._routes` in `def self.included(base)` will raise
`NoMethodError` because the `included` block will not yet have defined
the `_routes` method.

This commit prevents the error by first checking if `base` responds to
`_routes`.
2023-12-19 17:43:32 -06:00
Georg Ledermann
0fc5b06c08
Allow serving compressed SVG images
This adds `image/svg+xml` to the compressible content types
of ActionDispatch::Static

Co-authored-by: Mike Dalessio <mike.dalessio@gmail.com>
2023-12-14 11:38:07 -05:00
Eugene Kenny
8278626a2c
Merge pull request #49297 from hannahramadan/main
Add instrumentation for ActionController::Live#send_stream
2023-12-13 08:38:59 +00:00
hramadan
6488bd9ec0 Add instrumentation for ActionController::Live#send_stream
Allows subscribing to `send_stream` events.
The event payload contains the filename, disposition, and type.
2023-12-13 08:19:48 +00:00
Jean Boussier
572f4750f1
Merge pull request #47306 from zzak/re-47129
Follow up to HTTP::Request#route_uri_pattern
2023-12-11 18:39:05 +01:00
Aaron Patterson
0915a3eed8
Merge pull request #49858 from skipkayhil/hm-dont-assign-internal-variables
Prevent assigning internal ivars to AV::Base
2023-12-11 09:06:05 -08:00
Hartley McGuire
eed1cb25ed
Fix tests for status code change on Rack HEAD
Rack was recently [updated][1] with a deprecation for some status codes
that have been renamed (most notably, Unprocessable Entity was renamed
to Unprocessable Content). Since the deprecation was only added to
the `#status_code` method, this has caused test failures for some tests
that depend on the `SYMBOLS_TO_STATUS_CODE` hash.

This commit replaces the usage of `SYMBOLS_TO_STATUS_CODE` with
`#status_code` so that we get the deprecation message instead of a test
failure.

[1]: 64ad26e338
2023-12-11 01:17:28 -05:00
Ben Sheldon [he/him]
4c0eceae06
Do not instance_eval method into RoutesProxy 2023-12-08 15:39:12 -08:00
Jonathan Hefner
be272a83a0 Fix system tests with Chrome cached by Selenium
Follow-up to #49908.

When Selenium resolves the driver path to a copy of Chrome that it has
downloaded / cached, it mutates the `Selenium::WebDriver::Chrome::Options`
object it receives, and relies on those changes later when the options
are used.  If `Selenium::WebDriver::Chrome::Service.driver_path` is set
but a different options object is used, Selenium will raise "cannot find
Chrome binary".  Therefore, this commit ensures that the options object
passed to `Selenium::WebDriver::DriverFinder.path` is the same options
object used by the driver later.
2023-12-07 12:52:51 -06:00
Mario Caropreso
df6d2fbf2e Addressed an issue where syntax errors generated inside an eval
method cause an Internal Server Error due to a TypeError.

In order to display the extraced source of a syntax error, we try
to locate the node id for the backtrace location. The call to
RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location is expecting
a Thread::Backtrace::Location object, but we are passing a
SourceMapLocation instead.

This commit does two things:
1) it addresses the issue by making sure that we are always passing
a Thread::Backtrace::Location instead
2) it allows the development view to show the extracted source fragment
2023-12-05 06:40:19 +00:00
Hartley McGuire
ec3d392e20
Fix skips in Action Pack
We can't run this test on Ruby 2.7 due to minitest being locked in the
Gemfile to an older version, so we should use that as a condition
instead of skipping if minitest doesn't have metadata.
2023-11-30 11:11:22 -05:00
Jean Boussier
4467b26a3e
Merge pull request #50145 from fatkodima/include-db-errors-in-connection-errors
Include exception causes into log messages
2023-11-28 20:45:13 +01:00
Gannon McGibbon
d46d5ce610 Make with_routing test helper work for integration tests
Adds support for with_routing test helpers in ActionDispatch::IntegrationTest.
Previously, this helper didn't work in an integration context because
the rack app and integration session under test were not mutated.
Because controller tests are integration tests by default, we should
support test routes for these kinds of test cases as well.
2023-11-23 22:10:45 -06:00
fatkodima
4fc2df277d Include exception causes into log messages 2023-11-23 17:21:28 +02:00
Rafael Mendonça França
ec2c2666c2
Remove deprecated support to set Rails.application.config.action_dispatch.show_exceptions to true and false 2023-11-22 22:12:10 +00:00
Rafael Mendonça França
30193dc087
Remove deprecated speaker, vibrate, and vr permissions policy directives 2023-11-22 22:12:09 +00:00
Rafael Mendonça França
d088d9132f
Remove deprecated Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type. 2023-11-22 22:12:08 +00:00
Rafael Mendonça França
43e42c1ea8
Remove deprecated comparison between ActionController::Parameters and Hash 2023-11-22 22:12:07 +00:00
Rafael Mendonça França
87bc1190fb
Remove deprecated constant AbstractController::Helpers::MissingHelperError 2023-11-22 22:12:03 +00:00
Rafael Mendonça França
b2f96d07d4
Remove deprecated constant ActionDispatch::IllegalStateError 2023-11-22 22:11:43 +00:00
Thiago Pradi
f61a5d6878 Removing ActionPack fixture views that are not used anymore 2023-11-21 22:59:07 -03:00
Jean Boussier
b8d0f398fe Routing::Mapper: Use Thread.each_caller_location if available
Saves a lot of allocations. It's development only though.
2023-11-16 09:08:42 +01:00
John Hawthorn
591c4aa1ea Eager load Journey Formatter cache
This cache is used when url_for is called without a named route (ie.
when it's called with hash options). Eager loading avoids building the
cache on the first call and potentially allows the memory to be shared
via CoW on forking servers.
2023-11-07 20:16:43 -08:00
Matt Brictson
e7d743b8ac Preload Selenium driver_path before parallelizing system tests
When the webdrivers gem is not present (which is the default scenario in
Rails 7.1+), the Selenium `driver_path` starts out as `nil`. This means
the driver is located lazily, and deferred until a system test is run.

If parallel testing is used, this leads to a race condition, where each
worker process tries to resolve the driver simultaneously. The result is
an error as described in #49906.

This commit fixes the race condition by changing the implementation of
`Browser#preload`. The previous implementation worked when `driver_path`
was set to a Proc by the `webdrivers` gem, but doesn't work when the
`webdrivers` gem is not being used and the `driver_path` is `nil`.

`Browser#preload` now uses the `DriverFinder` utility provided by the
`selenium-webdriver` gem to eagerly resolve the driver path if needed.
This will ensures that `driver_path` is set before parallel test workers
are forked.

Fixes #49906.

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2023-11-07 11:15:18 -06:00
Hartley McGuire
24213d6954
Prevent assigning internal ivars to AV::Base
Previously, both the `@rendered_format` and
`@marked_for_same_origin_verification` instance variables would be
assigned to instances of `ActionView::Base`, making them accessible in
view templates. However, these instance variables are really internal to
the controller and result in extra string allocations because the `@`
gets stripped and readded when going through the assignment.

This commit prefixes the variables with an underscore to help indicate
that they are internal, and then adds them to the list of
`_protected_ivars` to prevent assigning them when rendering templates.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2023-11-03 20:52:47 -04:00
Jean Boussier
c28e4f2434 Use double quotes more consistenly in doc and error messages
For better or worse, the Rails guide settled on double quotes
and a large part of the community also use rubocop which enforce
them by default.

So we might as well try to follow that style when providing code
snippets in the documentation or error messages.

Fix: https://github.com/rails/rails/issues/49822

I certainly didn't get them all, but consistency should be significantly
improved.
2023-10-28 11:38:49 +02:00
Jonathan Hefner
e33dbe1b3d Fix code example indentation [ci-skip] 2023-10-26 17:37:32 -05:00
fatkodima
97ae6e7bce Fix StrongParameters#extract_value to include blank values
Co-authored-by: Yasha Krasnou <yakau@hey.com>
Co-authored-by: Matthias Eiglsperger <38067299+mateigl@users.noreply.github.com>
2023-10-23 23:14:49 +03:00
Hartley McGuire
5005480adf
Add racc dependency because it will be bundled
Ruby 3.3.0 is going to start warning for racc not being specififed as a
dependency, and Ruby 3.4.0 will raise if it is not specified.

This commit prevents those issues by adding racc to the Action Pack
gemspec, since `racc/parser` is a runtime dependency of the Journey
parser.
2023-10-20 12:59:18 -04:00
Jean Boussier
bcdeea5da7 Drop dependency on mutex_m
It used to be stdlib but is being extracted in modern rubies.

Overall its usefulness is dubious. In all cases it is included in
Rails, it's only for the `synchronize` method, but end up exposing
a dozen other useless methods.

In the end just using a Mutex is clearer and simpler.

In some cases we can even get away with a single mutex in a constant.
2023-10-18 14:27:26 +02:00
Nikita Vasilevsky
19f8ab2e7d
[Tests only] Enable Minitest/AssertPredicate rule 2023-10-13 19:26:47 +00:00
Carlos Antonio da Silva
dcb1d1f4c4 Use to_sentence to show list of methods without using I18n
This code was introduced by #17221 to workaround issues with not having
the `:en` locale set in the app to translate when calling `to_sentence`,
when having `I18n.enforce_available_locales` enabled.

We can still use the helper, with the defaults provided by the code,
without using I18n and thus without relying on the app locale, by
passing the `locale: false` option.
2023-10-13 13:10:06 -03:00
Carlos Antonio da Silva
5f3a817dd7 Simplify call / early return with safe navigator
As an extra small benefit, we just do one hash lookup.
2023-10-13 13:10:06 -03:00
zzak
6635543d51
Support handling Enumerator for non-buffered responses
The downside to this is that we cannot generate ETags for these types of responses, but are assuming that by using an enumerator they don't expect a buffered response to be cacheable. This means you cannot use Enumerator to generate streaming responses.

Fixes #49588

See also: #47092

Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
2023-10-13 11:12:16 +09:00
Rafael Mendonça França
452c9f6c71
Merge pull request #49538 from akhilgkrishnan/capitalize-framework-names
Capitalize framework names [skip ci]
2023-10-11 17:04:27 +02:00
fatkodima
b8829cabec Enable Style/RedundantDoubleSplatHashBraces rubocop cop 2023-10-11 14:55:00 +03:00
Akhil G Krishnan
c96695dfcf Capitalize framework names 2023-10-08 11:34:21 +05:30
Benjamin Stein
93797e8625
Fix typo in exception message re: raise_on_missing_callback_actions 2023-10-06 09:44:24 -07:00
Hartley McGuire
11a4f98a71
Fix login_procedure doc using backticks
Also convert a few other <tt> usage to plusses
2023-10-04 22:39:00 -04:00
Yaw Boakye
237dc9a35a
clarify login_procedure's responsibility 2023-10-04 15:27:43 +01:00
Petrik
9c96042690 Improve instrumentation tests
Don't build AS::Notifications::Event manually, similar to 95b6fbd00ff5de148286cf0cd73764f86356b3c2
Also assert that options get passed.
2023-10-03 13:14:37 +02:00
Sean Doyle
5c3cb9f0a6 Fix ActionController::Parameters#deep_merge RDoc [ci skip]
Follow-up to [#45369][]

First, add the final `:` to the `#deep_merge?` method's `:nodoc:`
declaration.

Next, move the `:method:` documentation out of the methods and into the
section of the class that defines the rest of the dynamic method
documentation.

Finally, move the `:call-seq:` methods below the directive, like the
rest of the methods.

[#45369]: https://github.com/rails/rails/pull/45369
2023-10-02 09:41:06 -04:00
Jean Boussier
02e679ba75 Get rid of the jruby_skip test helper
The last test calling it actually passes on latest
JRuby.
2023-10-02 13:01:44 +02:00
Rafael Mendonça França
7c303b9ddf
Merge pull request #49442 from p8/actionpack/notifications-tests
Add tests for send_file and redirect_to instrumentation
2023-10-01 17:30:00 -04:00
Petrik
989de534a5 Add tests for send_file and redirect_to instrumentation 2023-09-30 17:22:56 +02:00
Rafael Mendonça França
180e601196
Merge pull request #49374 from yykamei/add_doc_for_protect_from_forgery
Add notice to documentation for protect_from_forgery's :with option
2023-09-29 16:13:02 -04:00
Bart de Water
95b6fbd00f Stop building AS::Notifications::Event manually
It's possible since Rails 6 (3ea2857943dc294d7809930b4cc5b318b9c39577) to let the framework create Event objects, but the guides and docs weren't updated to lead with this example.

Manually instantiating an Event doesn't record CPU time and allocations, I've seen it more than once that people copy-pasting the example code get confused about these stats returning 0. The tests here show that - just like the apps I've worked on - the old pattern keeps getting copy-pasted.
2023-09-29 12:34:23 -04:00
Yutaka Kamei
f7cc8b3191
Move up the notice to the line of :with explanation 2023-09-29 11:45:42 +09:00
Hartley McGuire
3946ef20e1
Rm unused default_protect_from_forgery accessor
This was [added][1] when the default configuration was added for Rails
5.2, however the accessor itself has never been documented or used.
`protect_from_forgery: :exception` is added based on  whether the
configuration is set on `config.action_controller` and not this value.

Since the accessor is undocumented and unused, this commit removes it.

[1]: 48cb8b3e7097e9a1cb45b2298f59b9179f0dbdee
2023-09-28 20:38:44 -04:00
fatkodima
7ef86b6a49 Enable Lint/RedundantSafeNavigation rubocop cop 2023-09-27 14:55:07 +03:00
Rafael Mendonça França
fb6c6007d0
Development of Rails 7.2 starts now
🎉
2023-09-27 03:59:11 +00:00
Rafael Mendonça França
e5386cb402
Preparing for 7.1.0.rc1 release 2023-09-27 03:08:31 +00:00
Sean Doyle
1d999e681e Support ActionController::Parameters#deep_merge
When [rails/rails#20868][] changed the `ActionController::Parameters`
ancestory from `HashWithIndifferentAccess` to `Object`, support for
`#deep_merge` and `#deep_merge!` were omitted.

This commit restores support by integrating with
[ActiveSupport::DeepMergeable](./activesupport/lib/active_support/deep_mergeable.rb).

[rails/rails#20868]: https://github.com/rails/rails/pull/20868

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2023-09-26 16:27:28 -05:00
Yutaka Kamei
be31560a13
Add notice for protect_from_forgery's :with option
Thanks to https://github.com/rails/rails/pull/29742,
newly created Rails apps after Rails 5.2 don't have to deep dive into
CSRF problems, and they don't require direct call of
`protect_from_forgery`. However, some projects sill have to consider the
case where `protect_from_forgery` should be called.

Calling `protect_from_forgery` without `:with` option treats `:with` as
`:null_session` by default, not `:exception`, so I was a bit confused by
the inconsistency between `default_protect_from_forgery` and
`protect_from_forgery`. Maybe, changing the default `:with` to
`:exception` will bring significant breaking changes,
so I want to suggest adding a notice to the method.
2023-09-25 15:39:39 +09:00
Hartley McGuire
35b280fcc2
Refactor Router#find_routes to be lazier
Previously, `#find_routes` would take all of the routes that match the
current request and eagerly generate `MatchData` and `path_parameters`
for each route.

This commit changes `#find_routes` to only perform the computation one
route at a time, since the computation will never be needed for routes
in the list after `#serve` returns.

This change improves the performance of `RouteSet#call` by ~10% when
`#find_routes` finds two routes, and ~60% when `#find_routes` finds ten
routes.

Before:

```
Warming up --------------------------------------
  10 matching routes     1.182k i/100ms
   2 matching routes     1.967k i/100ms
   1 matching routes     2.221k i/100ms
Calculating -------------------------------------
  10 matching routes     11.846k (± 3.7%) i/s -     60.282k in   5.095922s
   2 matching routes     19.871k (± 3.5%) i/s -    100.317k in   5.054796s
   1 matching routes     21.904k (± 3.8%) i/s -    111.050k in   5.077449s

Comparison:
   1 matching routes:    21904.0 i/s
   2 matching routes:    19870.6 i/s - 1.10x  slower
  10 matching routes:    11845.9 i/s - 1.85x  slower
```

After:

```
Warming up --------------------------------------
  10 matching routes     1.888k i/100ms
   2 matching routes     2.215k i/100ms
   1 matching routes     2.312k i/100ms
Calculating -------------------------------------
  10 matching routes     18.623k (± 3.7%) i/s -     94.400k in   5.076043s
   2 matching routes     22.210k (± 3.6%) i/s -    112.965k in   5.092873s
   1 matching routes     22.953k (± 4.1%) i/s -    115.600k in   5.045017s

Comparison:
   1 matching routes:    22952.9 i/s
   2 matching routes:    22210.4 i/s - same-ish: difference falls within error
  10 matching routes:    18622.8 i/s - 1.23x  slower
```

Benchmark:

```
require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "actionpack", path: "~/src/github.com/skipkayhil/rails"
  gem "benchmark-ips"
end

require "action_dispatch"

routes = ActionDispatch::Routing::RouteSet.new
routes.draw do
  get "/a", to: ->(e) { [200, {}, ["a"]] }

  2.times do |i|
    is = "b" + i.to_s
    get "/b", to: ->(e) { [200, {}, [is]] }
  end

  10.times do |i|
    is = "c" + i.to_s
    get "/c", to: ->(e) { [200, {}, [is]] }
  end
end

one_env = {
  "REQUEST_METHOD" => "GET",
  "SCRIPT_NAME" => "",
  "rack.input" => File.open("/dev/null"),
  "PATH_INFO" => "/a",
}.freeze

two_env = {
  "REQUEST_METHOD" => "GET",
  "SCRIPT_NAME" => "",
  "rack.input" => File.open("/dev/null"),
  "PATH_INFO" => "/b",
}.freeze

ten_env = {
  "REQUEST_METHOD" => "GET",
  "SCRIPT_NAME" => "",
  "rack.input" => File.open("/dev/null"),
  "PATH_INFO" => "/c",
}.freeze

raise unless routes.call(one_env.dup)[2] == ["a"]
raise unless routes.call(two_env.dup)[2] == ["b0"]
raise unless routes.call(ten_env.dup)[2] == ["c0"]

require "benchmark/ips"

Benchmark.ips do |x|
  x.report("10 matching routes") { routes.call(ten_env.dup) }
  x.report("2 matching routes") { routes.call(two_env.dup) }
  x.report("1 matching routes") { routes.call(one_env.dup) }
  x.compare!
end
```
2023-09-20 17:25:11 -04:00
Shouichi Kamiya
51ac8b9f6f Enable Minitest/LiteralAsActualArgument
There are assertions that expected/actual arguments are passed in the
reversed order by mistake. Enabling the LiteralAsActualArgument rule
prevents this mistake from happening.

The existing tests were auto-corrected by rubocop with a bit of
indentation adjustment.

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2023-09-13 10:09:32 +09:00
Rafael Mendonça França
699dfdb426
Preparing for 7.1.0.beta1 release 2023-09-13 00:36:01 +00:00
Rafael Mendonça França
ed0c34d1e0
Merge pull request #48699 from kamil-gwozdz/fix-action_methods_with_inherited_shadowed_internal_method-v2
AbstractController#internal_methods: ignore action_methods
2023-09-09 16:55:26 -04:00
Alex Ghiculescu
ff6881d2b2
Remove old raise_on_missing_translations behaviour
ref: https://github.com/rails/rails/pull/47105#issuecomment-1400843060

Removes the old `raise_on_missing_translations` accessors, that used to live [here](fee61e3abc/actionpack/lib/abstract_controller/translation.rb (L7)) and [here](5c835bd669/actionview/lib/action_view/helpers/translation_helper.rb (L15)).

Closes https://github.com/rails/rails/pull/45361
2023-09-09 19:59:49 +00:00
Rafael Mendonça França
f2b1ff4eec
Bump dynamic controller and action segments yet again 2023-09-09 19:30:53 +00:00
Akhil G Krishnan
61a9c1a92a Ruby code block indentation issue fix
[skip ci] indentation fix

[skip ci] review changes added

[skip ci] indentation fix
2023-09-07 01:14:48 +05:30
Ryuta Kamizono
5415d3a19a Remove "proc to update web drivers." [ci-skip]
Follow-up to #48847.

This was originally "The webdrivers gem uses this proc to update web
drivers.".
2023-09-06 13:23:14 +09:00
euglena1215
9d2a7f89ee
Prevent NoMethodError in extract_value when specifying non-existent keys
Introduced in https://github.com/rails/rails/pull/49042, the method `ActionController::Parameters#extract_value` promises to replace utility methods that were previously defined as private methods in controllers.
However, it currently throws a `NoMethodError` when passed a non-existent key.

`params` is dependent on client requests and is thus beyond the application's control.
Rather than throwing a `NoMethodError`, it would be more convenient for the method to return `nil`.
2023-08-31 22:31:24 +09:00
Nikita Vasilevsky
da7a6da4e7
Add extract_value method to ActionController::Parameters
This commit adds `extract_value` method to `ActionController::Parameters`
as a primary way to extract composite `id` values serialized from
`ActiveRecord::Base#to_param` called on a model with a composite primary key.
2023-08-25 22:34:10 +00:00
Rafael Mendonça França
4df85d7089
Merge pull request #49029 from technicalpickles/abstractcontroller_base-action_methods-performance
Improve performance of AbstractController::Base#action_methods
2023-08-24 11:41:04 -04:00
Rafael Mendonça França
dc3da021ee
Fix comments and indentation 2023-08-24 15:22:34 +00:00
Josh Nichols
b2afa8b3fb
Improve performance of AbstractController::Base#action_methods
I was benchmarking some specs in my app, and saw this code come up in the
memory_profiler. It is by no means the biggest memory allocation, but it
is straightforward to make a slight improvement.

Primarily, this saves allocating one array by using concat instead of +
to add public_instance_methods(false).

That ends up being 10% less memory for my benchmark (3 actions), and 6%
faster.

```
Calculating -------------------------------------
            original     8.352k memsize (   208.000  retained)
                        22.000  objects (     2.000  retained)
                         6.000  strings (     0.000  retained)
         refactored3     7.616k memsize (   408.000  retained)
                        11.000  objects (     7.000  retained)
                         3.000  strings (     3.000  retained)

Comparison:
         refactored3:       7616 allocated
            original:       8352 allocated - 1.10x more
Warming up --------------------------------------
            original     2.326k i/100ms
         refactored3     2.441k i/100ms
Calculating -------------------------------------
            original     23.336k (± 0.7%) i/s -    118.626k in   5.083658s
         refactored3     24.692k (± 1.2%) i/s -    124.491k in   5.042345s

Comparison:
            original:    23336.0 i/s
         refactored3:    24692.5 i/s - 1.06x  faster
```

Benchmark and results are also posted to https://gist.github.com/technicalpickles/4a4ae6a9e2c42963af43a89f75e768fe
2023-08-24 09:30:50 -04:00
Jean Boussier
6beb15c04a Add some :nodoc: to SyntaxErrorProxy and friends
None of this is public API.
2023-08-24 09:52:18 +02:00
Rafael Mendonça França
818bfc269a
Remove deprecation messages from actionpack test suite
The 6.1 cache format that is the default is deprecated.
2023-08-23 18:43:35 +00:00
Sean Doyle
0f4ab82082 Ensure response.parsed_body support for pattern matching
Both `Nokogiri` and `Minitest` have merged the PRs mentioned to
integrate support for Ruby's Pattern matching
(https://github.com/sparklemotion/nokogiri/pull/2523 and
https://github.com/minitest/minitest/pull/936, respectively).

This commit adds coverage for those new assertions, and incorporates
examples into the documentation for the `response.parsed_body` method.

In order to incorporate pattern-matching support for JSON responses,
this commit changes the response parser to call `JSON.parse` with
[object_class: ActiveSupport::HashWithIndifferentAccess][object_class],
since String instances for `Hash` keys are incompatible with Ruby's
syntactically pattern matching.

For example:

```ruby
irb(main):001:0> json = {"key" => "value"}
=> {"key"=>"value"}
irb(main):002:0> json in {key: /value/}
=> false

irb(main):001:0> json = {"key" => "value"}
=> {"key"=>"value"}
irb(main):002:0> json in {"key" => /value/}
.../3.2.0/lib/ruby/gems/3.2.0/gems/irb-1.7.4/lib/irb/workspace.rb:113:in `eval': (irb):2: syntax error, unexpected terminator, expecting literal content or tSTRING_DBEG or tSTRING_DVAR or tLABEL_END (SyntaxError)
json in {"key" => /value/}
             ^

        .../ruby/3.2.0/lib/ruby/gems/3.2.0/gems/irb-1.7.4/exe/irb:9:in `<top (required)>'
        .../ruby/3.2.0/bin/irb:25:in `load'
        .../ruby/3.2.0/bin/irb:25:in `<main>'
```

When the Hash maps String keys to Symbol keys, it's able to be pattern
matched:

```ruby
irb(main):005:0> json = {"key" => "value"}.with_indifferent_access
=> {"key"=>"value"}
irb(main):006:0> json in {key: /value/}
=> true
```

[object_class]: https://docs.ruby-lang.org/en/3.2/JSON.html#module-JSON-label-Parsing+Options
2023-08-23 13:28:02 -04:00
Rafael Mendonça França
24876e6a79
Merge PR #48950 2023-08-21 19:27:53 +00:00
Rafael Mendonça França
3642668935
Merge pull request #48941 from skipkayhil/hm-show-correct-blocked-hosts
Fix host display when X_FORWARDED_HOST authorized
2023-08-21 15:05:44 -04:00
Guillermo Iguaran
5a21634407
Merge pull request #48956 from skipkayhil/hm-rack-lint-show-exceptions-failsafe
Add test coverage for ShowExceptions failsafe
2023-08-18 16:08:41 -07:00
Guillermo Iguaran
4ec3a986d5
Merge pull request #48959 from skipkayhil/hm-clean-filters-requires
Remove uneeded requires of core_ext/string/filters
2023-08-18 16:03:44 -07:00
Rafael Mendonça França
c82d624ea1
Fix documentation of with_routing in the class level
There is no assertions inside it.
2023-08-18 22:21:06 +00:00
Rafael Mendonça França
08cd280866
Use class method module instead of DSL
This will make sure documentation is generated for the module.
2023-08-18 22:11:48 +00:00
Hartley McGuire
ff6e885d59
Remove uneeded requires of core_ext/string/filters
`actionpack/lib/action_dispatch/routing.rb`
- added: 013745151be062aa4d0fc1f2a008a7303fdb6e04
- removed: 93034ad7fea7e00562103a7cd0acfab19bbfadf9

`activejob/lib/active_job/log_subscriber.rb`
- added: b314ab555e0d85e6efb41be94fb5f3a157bb12fe
- removed: 5ab2034730feacfc2caee418f8c0b55191d27427

`activemodel/lib/active_model/errors.rb`
- added: cf7fac7e29bb2816412c949fdaed3d61a923eb23
- removed: 9de6457ab0767ebab7f2c8bc583420fda072e2bd

`activerecord/lib/active_record/core.rb`
- added: b3bfa361c503e107aff4dee5edf79bd7fd3d3725
- removed: e1066f450d1a99c9a0b4d786b202e2ca82a4c3b3

`activesupport/lib/active_support/core_ext/module/introspection.rb`
- added: 358ac36edf1695fcbec0aa21f126a3d8b83d4b5a
- removed: 167b4153cac0069a21e0bb9689cb16f34f6abbaa

`activesupport/lib/active_support/duration.rb`
- added: 75924c4517c8f87712d3f59c11f10152ed57b9d8
- removed: a91ea1d51048342d13fc73f9b09ce4cfd086bb34

`railties/lib/rails/commands/server/server_command.rb`
- added: f2173648938b418d120f5a68d8f3862d8ae9dace
- removed: 553b86fc751c751db504bcbe2d033eb2bb5b6a0b

`railties/lib/rails/command/base.rb`
- added: 6813edc7d926965e5644cd8befaf229a35b9d8ca
- removed: b617a561d865a65cfc140caa0e3c4af4350bfcef
2023-08-16 17:39:25 -04:00
Hartley McGuire
6bf2ee09f7
Add test coverage for ShowExceptions failsafe
This adds additional test coverage to ShowExceptions, since one of the
possible responses it creates was not previously tested. Because of the
previous [addition][1] of Rack::Lint, this also demonstrates that the
Content-Type header needed to be fixed.

[1]: 339dda4a82356d173b62dab144870790618e40c6
2023-08-16 16:00:25 -04:00
Akira Matsuda
5cf742ef51
ERB is no longer in use here since c2e756a944fd3ca2efa58bd285c0e75e0b4794ab 2023-08-17 04:46:35 +09:00
Yuki Nishijima
72c5270e45 Add support for Playwright as a driver for system tests 2023-08-16 16:28:28 +09:00
Hartley McGuire
11ef3cecf0
Fix host display when X_FORWARDED_HOST authorized
Previously, when a Request had a non-authorized HTTP_HOST but an
authorized HTTP_X_FORWARDED_HOST, the HTTP_X_FORWARDED_HOST value would
be displayed as the one being blocked. However, this could be confusing
for users since that value would already be added to `config.hosts`.

This commit addresses the issue by tweaking how the blocked host is
displayed. Instead of always displaying Request#host (which will return
X_FORWARDED_HOST when present whether or not that's the host being
blocked), each host being blocked will be displayed on its own.

Co-authored-by: Daniel Schlosser <Eusebius1920@users.noreply.github.com>
2023-08-15 03:27:13 -04:00
Matija Čupić
eed1ac1782
Use relative path for screenshot metadata 2023-08-05 15:20:01 +02:00
Rafael Mendonça França
2df0e5fa0c
Merge pull request #48857 from seanpdoyle/fixture-file-upload-rename
Rename `fixture_file_upload` method to `file_fixture_upload`
2023-08-04 17:08:40 -04:00
Sean Doyle
6cafc49d2c Rename fixture_file_upload method to file_fixture_upload
The naming difference between the test harness' [file_fixture][] helper
made available through Active Support (along with the
`file_fixture_path` configuration value) and the integration test
harness' [fixture_file_upload][] is a constant source of confusion and
surprise.

Since Active Support is more ubiquitous, this commit renames the
`fixture_file_upload` method to `file_fixture_upload` to match the order
of words in `file_fixture` and `file_fixture_path`.

To preserve backwards compatibility, declare a `fixture_file_upload`
alias to be preserved into the future (or removed at a future point in
time).

[file_fixture]: https://edgeapi.rubyonrails.org/classes/ActiveSupport/Testing/FileFixtures.html#method-i-file_fixture
[fixture_file_upload]: https://edgeapi.rubyonrails.org/classes/ActionDispatch/TestProcess/FixtureFile.html#method-i-fixture_file_upload
2023-08-04 12:40:17 -04:00
Bryan Traywick
a4633725d2 Fix NoMethodError when request Content-Type is blank. 2023-08-04 12:36:11 -04:00
Mike Dalessio
8a57ba8c0e
Update Action View and Dispatch to use Rails::Dom::Testing helpers
Use the helpers introduced in rails-dom-testing 2.2.0 instead of
managing the HTML parsers as was done in #48523.

See also related #47144 / ad79ed0e
2023-08-03 11:17:38 -04:00
Jean Boussier
ee3117ba8a
Merge pull request #48863 from matteeyah/main
Save screenshot path on system test failure
2023-08-03 16:35:29 +02:00
Eugene Kenny
797a7c5a62 Fix typos in RequestForgeryProtection docs [ci-skip] 2023-08-03 13:58:26 +01:00
Matija Čupić
a962fc3c9c
Save failure screenshot path in test metadata 2023-08-03 14:43:49 +02:00
Rafael Mendonça França
e980f158a4
Merge pull request #48847 from seanpdoyle/omit-webdrivers-from-gemfile-template
Omit `webdrivers` gem from `Gemfile` template
2023-08-02 13:49:28 -04:00
Guillermo Iguaran
4c9a990ffd
Merge pull request #48855 from akhilgkrishnan/add-rack-link-to-debug-exception-missing-test
Add Rack::Lint to DebugExceptions missing test
2023-08-01 10:38:33 -07:00
Sean Doyle
9a53234695 Omit webdrivers gem from Gemfile template
As of Selenium 4.6, [the Selenium Manager is capable of managing Chrome
Driver installations and integrations][readme]. As of Selenium 4.11, the
Selenium Manager is capable of [capable of resolving the Chrome for
Testing installation][] path.

By omitting the `gem` declaration from the `Gemfile.tt`, newly generated
applications and applications updating their `Gemfile` in lockstep with
newer Rails versions can shed the dependency and avoid test failures
introduced by newly released Chrome versions (like, for example,
[titusfortner/webdrivers#247][]).

[readme]: 43f8ac436c (update-selenium-manager)
[titusfortner/webdrivers#247]: https://github.com/titusfortner/webdrivers/issues/247
[capable of resolving the Chrome for Testing installation]: https://github.com/rails/rails/pull/48847#issuecomment-1656756862

Co-authored-by: Titus Fortner <titusfortner@users.noreply.github.com>
2023-08-01 09:22:08 -04:00
Adrianna Chang
339dda4a82
Add Rack::Lint to ActionDispatch::ShowExceptions tests
This wraps test coverage for `ActionDispatch::ShowExpections` in
`Rack::Lint` middleware in order to validate that both
`ActionDispatch::ShowExceptions` and `ActionDispatch::PublicExceptions`
conform to the Rack SPEC.

It also ensures that the response headers returned by the *Exceptions
middleware respect casing (mixed case for Rack 2, lower case for Rack 3)
2023-08-01 09:18:59 -04:00
Nuno Silva
613e8fd0a1
Add Rack::Lint to ActionDispatch::RemoteIp tests
To ensure Rails is and remains compliant with [the Rack 3
spec](6d16306192/UPGRADE-GUIDE.md)
we can add `Rack::Lint` to the Rails middleware tests.

This adds additional test coverage to
`ActionDispatch::RemoteIp` to validate that its input and
output follow the Rack SPEC.

The only code testing this middleware are the ones for
`ActionDispatch::Request`.

Several changes were required to make the tests pass:

- `CONTENT_LENGTH` must be a string
- `SERVER_PORT` must be a string
- `HTTP_HOST` must be a string
- `rack.input` must be an IO object, with ASCII-8BIT encoding
     - By leveraging `Rack::MockRequest`, we can pass the symbol :input,
       and the string value, and it will be converted to an IO object
       with the correct encoding.
     - See [definition here](444dc8a130/lib/rack/mock_request.rb (L89-L97))
- using `Rack::MockRequest` also means that any symbol keys being passed
to setup the env, will be discarded. [Only string keys are copied.]444dc8a130/lib/rack/mock_request.rb (L156)
2023-07-31 08:13:04 +00:00
Akhil G Krishnan
7df276f938 Add Rack::Lint to DebugExceptions missing test 2023-07-31 13:19:32 +05:30
Guillermo Iguaran
ad790cb2f6
Merge pull request #48837 from skipkayhil/hm-rack-lint-debug-exceptions
Add Rack::Lint to DebugExceptions tests
2023-07-30 23:58:34 -07:00
Hartley McGuire
ac7ee278fd
Add Rack::Lint to DebugExceptions tests
This adds additional test coverage to DebugExceptions to validate that
its behavior conforms to the Rack SPEC.

The only changes necessary were to use dynamic header casing for
Content-Type and Content-Length
2023-07-29 16:49:10 -04:00
Akhil G Krishnan
15bca6e94d Add Rack::Lint to ActionDispatch::Reloader tests 2023-07-29 14:18:49 +05:30
Adrianna Chang
2401b336fb
Use expected casing for x-cascade headers in router
This commit changes the router to use the expected casing for the
x-cascade header: in Rack 2, this is mixed-case, and in Rack 3, this is
lower case.

This also fixes https://github.com/rails/rails/issues/47096.
2023-07-28 16:17:08 -04:00
Adrianna Chang
9d840a1719
Make ActionDispatch::SSL compatible with Rack 3.0
Rack 3 now allows response header values to be an Array when handling
multiple values. Newline encoded headers are no longer supported.

This commit updates `ActionDispatch::SSL#flag_cookies_as_secure!` to
be Rack-3 compliant by setting the `set-cookie` header to an Array
rather than a newline-separated String if the current Rack version is
3+.

Additionally, this commit adds `Rack::Lint` to the Rack app in the
middleware test suite so that we can ensure all of the tests are
compliant with the Rack SPEC.
2023-07-28 14:23:25 -04:00
Eileen M. Uchitelle
43be5c4dc4
Merge pull request #48839 from skipkayhil/hm-rack-lint-test-request
Fix TestRequest coercing SERVER_PORT to be an int
2023-07-28 14:08:47 -04:00
Guillermo Iguaran
1788f67431
Merge pull request #48812 from nunosilva800/ns-rack-lint-content-security-policy-middleware
Add Rack::Lint to ContentSecurityPolicy::Middleware tests
2023-07-28 10:27:26 -07:00
Guillermo Iguaran
0a39604161
Merge pull request #48805 from skipkayhil/hm-rack-lint-request-id
Add Rack::Lint to RequestId tests
2023-07-28 10:25:50 -07:00
Hartley McGuire
70335e0793
Fix TestRequest coercing SERVER_PORT to be an int
In both Rack 2 and Rack 3, all headers must be strings. SERVER_PORT has
an additional requirement that it must be an Integer (represented as a
string).

When using #port= on a TestRequest, the value passed has been coerced
into an integer since it was [introduced][1]. Since this is explicitly
incorrect per both Rack 2 and Rack SPEC, the coercion is removed.

This does have the potential to change the value for users who are
checking TestRequest#headers directly, but if they are using
Request#port the value will not change because #port also coerces values
to ints.

[1]: 61960e7b37767140e9af68bd5373e06dce08492d
2023-07-28 13:02:27 -04:00
Nuno Silva
04c61163bf
Add Rack::Lint to ActionDispatch::ServerTiming tests
To ensure Rails is and remains compliant with [the Rack 3
spec](6d16306192/UPGRADE-GUIDE.md)
we can add `Rack::Lint` to the Rails middleware tests.

This adds additional test coverage to `ActionDispatch::ServerTiming` to
validate that its input and output follow the Rack SPEC.

The `Server-Timing` header definition was moved to
`ActionDispatch::Constants` and is now downcased to match the Rack 3
SPEC.

The tests that rely on a `Concurrent::CyclicBarrier` ("events are
tracked by thread") were changed since passing the required proc in the
env is not compatible with the SPEC:

```
Rack::Lint::LintError: env variable proc has non-string value
```

The same can be achieved by invoking the proc as a child Rack app.
2023-07-28 15:24:32 +00:00
Hartley McGuire
b2da0053aa
Add Rack::Lint to RequestId tests
This adds additional test coverage to RequestId to validate that its
input and output follow the Rack SPEC.

In this case, the only changes necessary were to the Request tests. This
is due to the fact that the Request and Response tests use different
classes for their Response headers. The Response tests simulate a Rails
app, where the Response headers will be a Rack::Headers object for
compatbility with both Rack 2 and 3. However, since the Request tests
are only using the Hash returned by the test app, the tests must use a
downcased header to support both Rack 2 and Rack 3.
2023-07-28 10:29:31 -04:00
Eileen M. Uchitelle
dda937fa62
Merge pull request #48819 from skipkayhil/hm-doc-integration-tweaks
Add and remove some links in IntegrationTest docs [ci skip]
2023-07-28 08:54:53 -04:00
Eileen M. Uchitelle
924a371e38
Merge pull request #48788 from ylecuyer/fix-selenium-tests-yle
Fix: Do not execute selenium driver_path if it is a string.
2023-07-28 08:53:25 -04:00
Nuno Silva
d1381dc654
Add Rack::Lint to ContentSecurityPolicy::Middleware tests
To ensure Rails is and remains compliant with [the Rack 3
spec](6d16306192/UPGRADE-GUIDE.md)
we can add `Rack::Lint` to the Rails middleware tests.

This adds additional test coverage to
`ContentSecurityPolicy::Middleware` to validate that its input and
output follow the Rack SPEC.

The changes made are because of:
- [Response Headers must be lower case](6d16306192/UPGRADE-GUIDE.md (response-headers-must-be-lower-case))

Added tests to ensure that CSP headers set by an app are not overridden,
regardless of the casing.
An example of this is Sidekiq: https://github.com/sidekiq/sidekiq/blob/b3225ce/lib/sidekiq/web/application.rb#L353
2023-07-28 09:37:23 +00:00
Guillermo Iguaran
ff232b1190 Move X-Request-Id header name to ActionDispatch::Constants 2023-07-27 16:03:52 -07:00
Guillermo Iguaran
5b45803984 Use constants defined in ActionDispatch::Constants instead of conditional assignments 2023-07-27 15:21:18 -07:00
Guillermo Iguaran
1fd79abb54 Define constants for headers in ActionDispatch::Constants to avoid conditional checks around multiple classes 2023-07-27 15:20:33 -07:00
Guillermo Iguaran
71ce2fd309
Merge pull request #48825 from nunosilva800/ns-rack-lint-executor
Add Rack::Lint to ActionDispatch::Executor tests
2023-07-27 14:43:00 -07:00
Yoann Lecuyer
bd8a6778a0 Fix: Do not execute selenium driver_path if it is a string. 2023-07-27 22:57:49 +02:00
Guillermo Iguaran
034cae80a9
Merge pull request #48818 from skipkayhil/hm-rack-list-permissions-policy
Add Rack::Lint to PermissionsPolicy tests
2023-07-27 13:56:03 -07:00
Eileen M. Uchitelle
c9a104008f
Merge pull request #48832 from skipkayhil/hm-rack-lint-debug-locks
Add Rack::Lint to DebugLocks tests
2023-07-27 16:51:53 -04:00
Eileen M. Uchitelle
6f396113d0
Merge pull request #48810 from nunosilva800/ns-rack-lint-callbacks
Add Rack::Lint to ActionDispatch::Callbacks tests
2023-07-27 16:51:20 -04:00
Hartley McGuire
fe5eb3d0fb
Add Rack::Lint to DebugLocks tests
This adds additional test coverage to HostAuthorization to validate that
its behavior conforms to Rack SPEC.

This fixes the following two issues in the reponse returned by
DebugLocks:
- Rack::Lint::Error: uppercase character in header name
  Content-{Type/Length}
- Rack::Lint::Error: a header value must be a String or Array of
  Strings, but the value of 'content-length' is an Integer
2023-07-27 16:33:41 -04:00