1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

25 commits

Author SHA1 Message Date
Rafael Mendonça França
5087d00153
Always ask for a header argument in ResquestId middleware 2020-10-30 00:41:59 +00:00
Arlston Fernandes
2711dcc9a6
Customise the header name for ActionDispatch::RequestId
by setting `config.action_dispatch.request_id_header` to the desired value

* Ensure HTTP_X_REQUEST_ID presence to maintain compatiblility

* Use req.headers[] to fetch header rather than ENV methods

* Update configuration doc to match existing descriptions

* Add changelog entry for action_dispatch.request_id_header
2020-10-30 00:31:09 +00:00
Yasuo Honda
aa3dcabd87 Add Style/RedundantFreeze to remove redudant .freeze
Since Rails 6.0 will support Ruby 2.4.1 or higher
`# frozen_string_literal: true` magic comment is enough to make string object frozen.
This magic comment is enabled by `Style/FrozenStringLiteralComment` cop.

* Exclude these files not to auto correct false positive `Regexp#freeze`
 - 'actionpack/lib/action_dispatch/journey/router/utils.rb'
 - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb'

It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333
Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed.

* Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required

 - 'actionpack/test/controller/test_case_test.rb'
 - 'activemodel/test/cases/type/string_test.rb'
 - 'activesupport/lib/active_support/core_ext/string/strip.rb'
 - 'activesupport/test/core_ext/string_ext_test.rb'
 - 'railties/test/generators/actions_test.rb'
2018-09-29 07:18:44 +00:00
Daniel Colson
eea28f4103 Allow @ in X-Request-Id header
It makes sense to be as strict as possible
with headers from the outside world,
but allowing @ to support Apache's mod_unique_id
(see #31644) seems OK to me
2018-01-29 19:35:39 -05:00
Kir Shatrov
dfcc766163 Use frozen string literal in actionpack/ 2017-07-29 14:02:40 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Andrey Molchanov
9a130ee465 [ci-skip] Swap method and its alias, format doc 2016-10-04 00:37:40 +03:00
Xavier Noria
628e51ff10 applies new string literal convention in actionpack/lib
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:51:43 +02:00
Aaron Patterson
cf985d1a4e add a branch to eliminate multiple nil checks
if we add an else conditional to the `presence` check, we can eliminate
the second `||` branch in the caller
2015-05-23 11:38:23 -07:00
Aaron Patterson
42e66fac38 move request id manipulation to the request object
this way we can keep the knowledge of `env` hash keys in one place.
2015-05-22 16:29:16 -07:00
David Ilizarov
7f5cf3a3da Aliased the ActionDispatch::Request#uuid method with ActionDispatch::Request#request_id 2015-02-20 20:43:39 -02:00
eileencodes
95ee93892a Freeze strings to reduce allocations in integration tests
Moves `X-Request-ID`, `action_dispatch.request_id` and
`HTTP_X_REQUEST_ID` strings to constants and freezes them.

We are freezing these strings to reduce the number of allocations in
Rails integration tests. The tests are spending a lot of time in GC and
this reduces the amount of time spent from 12% to 9% (in combination
with Rack PR that also freezes some strings).

Number of allocations before this change: 1030722
Number of allocations after this change: 967722
2015-02-18 18:54:37 -05:00
Akshay Vishnoi
51a759a745 use 'based on' instead of 'based off' [ci skip] 2014-08-12 18:40:14 +05:30
Agis Anastasopoulos
a779ea9d57 Mark unused variables and make some style fixes
It'd be a nice convention to mark the unused variables like this, now that Ruby 2 will issue no warnings for such vars being unused.
2013-04-08 22:52:32 +03:00
Xavier Noria
8f58d6e507 load active_support/core_ext/object/blank in active_support/rails 2012-08-02 21:59:22 +02:00
Jeremy Kemper
ceb66b6126 Tap, tap goes the middleware 2012-02-29 18:43:55 -07:00
Arun Agrawal
0f510e970f Using uuid which is supported in 1.9
Orignal commit #ada78066fdbccffb1da092a2470211fa252b3c99
2011-12-21 17:55:57 +05:30
Marc Bowes
951a325c99 Remove the unneeded \d when sanitizing X-Request-Id. 2011-10-20 10:00:42 +03:00
José Valim
4ef7453694 Load object/blank and make use of presence. 2011-10-19 22:10:43 +02:00
José Valim
f1fecd9b4e Make tests run on 1.8.x, add integration setup. 2011-10-19 22:09:36 +02:00
David Heinemeier Hansson
ada78066fd Blah, SecureRandom#uuid is not supported in 1.8.7 -- cant wait for Rails 4.0 to drop compatibility with 1.8.x 2011-10-19 14:45:42 -05:00
José Valim
1b50207ed3 Require missing string access dependency. 2011-10-19 22:17:54 +03:00
José Valim
ddbb2cae31 Require securerandom as it is the proper dependency. 2011-10-19 22:15:25 +03:00
David Heinemeier Hansson
afde6fdd5e Added X-Request-Id tracking and TaggedLogging to easily log that and other production concerns 2011-10-19 12:59:33 -05:00