aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove deprecated support to passing strings to the middleware stackRafael Mendonça França2016-10-101-20/+1
|
* Remove deprecated code in ssl middlewareRafael Mendonça França2016-10-101-21/+3
|
* Remove deprecated code in ActionDispatch::Session::SessionRestoreErrorRafael Mendonça França2016-10-101-11/+1
|
* Deprecated ActionDispatch::ParamsParser::ParamsParserRafael Mendonça França2016-10-104-33/+27
| | | | | | ActionDispatch::ParamsParser class was removed in favor of ActionDispatch::Http::Parameters so it is better to move the error constant to the new class.
* Remove deprecated ActionDispatch::ParamsParserRafael Mendonça França2016-10-101-12/+1
|
* Remove deprecated code in ActionDispatch::ParamsParser::ParseErrorRafael Mendonça França2016-10-101-17/+1
|
* Remove deprecated access to mime types through constantsRafael Mendonça França2016-10-101-26/+0
|
* Undefine assings in IntegrationTestRafael Mendonça França2016-10-071-0/+2
| | | | | assigns assert the state of a controller instance what should not be done in an integration test.
* [ci-skip] Swap method and its alias, format docAndrey Molchanov2016-10-041-3/+4
|
* Show an "unmatched constraints" error for mismatching and present paramsChris Carter2016-10-032-2/+6
| | | | | | | | | | | | Currently a misleading "missing required keys" error is thrown when a param fails to match the constraints of a particular route. This commit ensures that these params are recognised as unmatching rather than missing. Note: this means that a different error message will be provided between optimized and non-optimized path helpers, due to the fact that the former does not check constraints when matching routes. Fixes #26470.
* Only search fixture_path for files that can't be found directlyMatthew Draper2016-09-241-1/+2
| | | | | | | | | | When passed an already-valid file name, prepending the path is likely to create problems. This is particularly relevant for #26384, which adds fixture_path handling to test classes that previously didn't have it: any existing caller must have been manually locating the file, and we don't want to break them.
* Merge pull request #26589 from kirs/ad-test-request-methodArthur Nogueira Neves2016-09-221-1/+1
|\ | | | | Fix memoization bug on ActionDispatch::TestRequest#request_method=
| * Fix memoization bug on ActionDispatch::TestRequest#request_method=Kir Shatrov2016-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TestRequest have been overrriding request_method setter since 2009, but the actual implementation in Request (not TestRequest) has been changed since that. Now it's also using @request_method instance variable to keep the state. The override in TestRequest have not been calling `super`, which caused a bug that after accessing #requst_method the value was memoized and then we've never been able to change it anymore: ``` req = ActionDispatch::TestRequest.create puts "was: #{req.request_method}" # memoized here req.request_method = "POST" puts "became: #{req.request_method}" ``` output: ``` was: GET became: GET ``` Since the whole purpose of overriding the setter in TestRequest is to upcase it, I'm changing it to `super(method.to_s.upcase)`
* | Merge pull request #26477 from kirs/action_dispatch-assert_responseRafael França2016-09-141-1/+6
|\ \ | | | | | | Improve assert_response helper
| * | Improve assert_response helperKir Shatrov2016-09-141-1/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the check is failed, print the actual response body if it's not too large. This could improve productivity when writing new tests. Before: ``` ThemeEditorIntegrationTest#test_whatever Expected response to be a <200: ok>, but was a <422: Unprocessable Entity>. Expected: 200 Actual: 422 ``` After: ``` ThemeEditorIntegrationTest#test_whatever Expected response to be a <200: ok>, but was a <422: Unprocessable Entity>. Expected: 200 Actual: 422 Response body: {"errors":["Invalid settings object for section '1'"]} ```
* / Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-143-26/+26
|/ | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Merge pull request #26384 from ↵Eileen M. Uchitelle2016-09-041-1/+3
|\ | | | | | | | | y-yagi/make_fixture_file_upload_in_integration_test make `fixture_file_upload` work in integration tests
| * make `fixture_file_upload` work in integration testsyuuji.yaginuma2016-09-041-1/+3
| | | | | | | | | | | | | | | | | | Currently, `fixture_file_upload` does not work in integration test. Because, `TestProcess` module has been include in `Session` class, but `fixture_path` can not get from `Session` class. Modify to include `TestProcess` in `IntegrationTest` class in order to get correct value of `fixture_path`.
* | Fix broken heredoc indentation caused by rubocop auto-correctRyuta Kamizono2016-09-032-2/+2
|/ | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But heredocs was still kept absolute position. This commit aligns heredocs indentation for consistency.
* RuboCop is 100% green :tada:Xavier Noria2016-09-021-10/+11
|
* fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-013-4/+4
|
* Start passing cipher from EncryptedCookieJar since we use it to determine ↵Vipul A M2016-09-011-7/+5
| | | | key length
* Follow up of #25602Vipul A M2016-09-011-4/+6
| | | | | | | | | Since keys are truncated, ruby 2.4 doesn't accept keys greater than their lenghts. keys of same value but different lenght and greater than key size of cipher, produce the same results as reproduced at https://gist.github.com/rhenium/b81355fe816dcfae459cc5eadfc4f6f9 Since our default cipher is 'aes-256-cbc', key length for which is 32 bytes, limit the length of key being passed to Encryptor to 32 bytes. This continues to support backwards compat with any existing signed data, already encrupted and signed with 32+ byte keys. Also fixes the passing of this value in multiple tests.
* Override `respond_to_missing?` instead of `respond_to?` when possibleSean Griffin2016-08-312-2/+2
| | | | | | | | | | This was almost every case where we are overriding `respond_to?` in a way that mirrors a parallel implementation of `method_missing`. There is one remaining case in Active Model that should probably do the same thing, but had a sufficiently strange implementation that I want to investigate it separately. Fixes #26333.
* Merge pull request #26317 from maclover7/jm-fix-26298Aaron Patterson2016-08-291-8/+15
|\ | | | | Allow `send_file` to declare a charset
| * Remove default argument, and extract internal convenience methodJon Moss2016-08-291-6/+12
| |
| * Allow `send_file` to declare a charsetJon Moss2016-08-291-4/+5
| | | | | | | | | | | | Removed my patch in favor of @tenderlove's less invasive approach. [Aaron Patterson & Jon Moss]
* | Fix nested multiple rootsRyo Hashimoto2016-08-291-1/+1
|/ | | | | | | | | | | | | | | The PR #20940 enabled the use of multiple roots with different constraints at the top level but unfortunately didn't work when those roots were inside a namespace and also broke the use of root inside a namespace after a top level root was defined because the check for the existence of the named route used the global :root name and not the namespaced name. This is fixed by using the name_for_action method to expand the :root name to the full namespaced name. We can pass nil for the second argument as we're not dealing with resource definitions so don't need to handle the cases for edit and new routes. Fixes #26148.
* Missing key should throw KeyErroreileencodes2016-08-261-1/+1
| | | | | | It should not throw a NameError, but should throw a KeyError. Fixes #26278
* Merge pull request #26235 from ↵Sean Griffin2016-08-241-1/+5
|\ | | | | | | | | samphippen/allow-early-setting-of-integration-session Allow the `integration_sesion` to be set early on ActionDispatch::Integration::Runner.
| * Move setting of integration session to constructor.Sam Phippen2016-08-211-1/+5
| | | | | | | | This allows us to not `||=` in `before_setup`.
| * Allow the `integration_sesion` to be set early on ↵Sam Phippen2016-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActionDispatch::Integration::Runner. In commit fa63448420d3385dbd043aca22dba973b45b8bb2, @tenderlove changed the behaviour of the way `integration_session` is set up in this object. It used to be the case that the first time it was accessed, it was memoized with nil, however, this means that if it had already been set it was not replaced. After that commit, it is now always set to `nil` in the execution of `before_setup`. In RSpec, users are able to invoke `host!` in `before(:all)` blocks, which execute well before `before_setup` is ever invoked (which happens in what is equivalent to a `before(:each)` block, for each test. `host!` causes the integration session to be set up to correctly change the host, but after fa63448420d3385dbd043aca22dba973b45b8bb2 the `integration_session` gets overwritten, meaning that users lose their `host!` configuration (see https://github.com/rspec/rspec-rails/issues/1662). This commit changes the behaviour back to memoizing with `nil`, as opposed to directly overwriting with `nil`. This causes the correct behaviour to occur in RSpec, and unless I'm mistaken will also ensure that users who want to modify their integration sessions early in rails will also be able to do so.
* | Return 307 status instead of 301 when rerouting POST requests to SSLChirag Singhal2016-08-221-1/+9
| | | | | | | | | | | | | | | | | | | | | | When `config.force_ssl` is set to `true`, any POST/PUT/DELETE requests coming in to non-secure url are being redirected with a 301 status. However, when that happens, the request is converted to a GET request and ends up hitting a different action on the controller. Since we can not do non-GET redirects, we can instead redirect with a 307 status code instead to indicate to the caller that a fresh request should be tried preserving the original request method. `rack-ssl` gem which was used to achieve this before we had this middleware directly baked into Rails also used to do the same, ref: https://github.com/josh/rack-ssl/blob/master/lib/rack/ssl.rb#L54 This would be specially important for any apps switching from older version of Rails or apps which expose an API through Rails.
* | Fix `ActionDispatch::Http::URL` docs [ci skip]Ryoji Yoshioka2016-08-221-65/+21
|/ | | | Use ActionDispatch::Request instead of Request because ActionDispatch::Request no longer inherits from Rack::Request.
* Change method visibility to be privateRafael Mendonça França2016-08-171-57/+57
| | | | | Those methods are only using inside this module and by a private method so they all should be private.
* Push :defaults extraction down one levelRafael Mendonça França2016-08-171-60/+60
| | | | | | | | | | | | | Since e852daa6976cc6b6b28ad0c80a188c06e226df3c only the verb methods where extracting the defaults options. It was merged a fix for the `root` method in 31fbbb7faccba25b2e3b5e10b8fca1468579d629 but `match` was still broken since `:defaults` where not extracted. This was causing routes defined using `match` and having the `:defaults` keys to not be recognized. To fix this it was extracted a new private method with the actual content of `match` and the `:defaults` extracting was moved to `match`.
* Merge pull request #26156 from sfaxon/route_visualizer_fixRafael França2016-08-161-1/+3
|\ | | | | fix Rails.application.routes.router.visualizer for router debugging
| * fix Rails.application.routes.router.visualizer for router debuggingSeth Faxon2016-08-131-1/+3
| | | | | | | | fixes error due to Routes#partitioned_routes being removed
* | Add three new rubocop rulesRafael Mendonça França2016-08-1615-25/+25
| | | | | | | | | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* | [ci skip] Link to the request helpers documentation.Kasper Timm Hansen2016-08-141-0/+3
| | | | | | | | | | | | It's tough for people without the knowledge of where the `get` and friends integration test helpers are defined to find documentation for them. Add a link to the main integration test documentation.
* | [ci skip] Update integration test request encoding documentation.Kasper Timm Hansen2016-08-141-13/+14
|/ | | | | | | * Give the section a header to distinguish it from the general doc. * Replace backticks with + signs to fit SDoc. * Use double quoted strings. * Clarify how `parsed_body` works — it doesn't depend on `as` anymore.
* Make private method privateRafael Mendonça França2016-08-121-11/+11
|
* Given a hash (Rails 5) .from_hash must be usedJavier Julio2016-08-121-1/+1
| | | When initializing an `ActionDispatch::Http::Headers` object it takes a request object (Rails 5) whereas before it took a hash (Rails 4.x) but the documented example still shows a hash given to the constructor (due to commit 34fa6658dd1b779b21e586f01ee64c6f59ca1537) so this is just a documentation change to use the new `from_hash` method introduced in that earlier commit.
* Allow specifying encoding of parameters by actionKerri Miller2016-08-093-1/+18
| | | | | At GitHub we need to handle parameter encodings that are not UTF-8. This patch allows us to specify encodings per parameter per action.
* revises more Lint/EndAlignment offensesXavier Noria2016-08-083-8/+8
|
* Fix Accept header overridden when "xhr: true" in integration testDavid Chen2016-08-071-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | In integration test when specify the "Accept" header with "xhr: true" option, the Accept header is overridden with a default xhr Accept header. The issue only affects HTTP header "Accept" but not CGI variable "HTTP_ACCEPT". For example: get '/page', headers: { 'Accept' => 'application/json' }, xhr: true # This is WRONG! And the response.content_type is also affected. # It should be "application/json" assert_equal "text/javascript, text/html, ...", request.accept assert_equal 'text/html', response.content_type The issue is in `ActionDispatch::Integration::RequestHelpers`. When setting "xhr: true" the helper sets a default HTTP_ACCEPT if blank. But the code doesn't consider supporting both HTTP header style and CGI variable style. For detail see this GitHub issue: https://github.com/rails/rails/issues/25859
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-072-3/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-0613-16/+5
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-0626-734/+733
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-065-5/+5
|