aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
Commit message (Collapse)AuthorAgeFilesLines
* Extract variant setter to process methodJon Moss2017-01-022-4/+10
| | | | | | | Provide an API interface similar to how format is handled in Controllers. In situations where variants are not needed (ex: in Action Mailer) the method will simply trigger a no-op, and will not affect end users.
* Bump license years for 2017Jon Moss2016-12-312-2/+2
| | | | | | | | Per https://www.timeanddate.com/counters/firstnewyear.html, it's already 2017 in a lot of places, so we should bump the Rails license years to 2017. [ci skip]
* fix with_routing when testing api only controllersJulia López2016-12-291-2/+5
|
* Use `next` instead of `break`; avoid terminating whole loopJon Moss2016-12-291-1/+1
| | | | | | | | | | | | | | We want to avoid terminating the whole loop here, because it will cause parameters that should be removed to not be removed, since we are terminating early. In this specific case, `param2` is processed before `param1` due to the reversing of `route.parts`, and since `param2` fails the check on this line, it would previously cause the whole loop to fail, and `param1` would still be in `parameterized_parts`. Now, we are simply calling `next`, which is the intended behavior. Introduced by 8ca8a2d773b942c4ea76baabe2df502a339d05b1. Fixes #27454.
* Use proper output format [ci skip] (#27498)प्रथमेश Sonpatki2016-12-291-1/+1
|
* Update request.rb --ci skipShardul Parab2016-12-291-0/+3
| | | | | | | | | | | | | | | | Documentation for ActionDispatch::Request#key? [ci skip] Update request.rb --ci skip Documentation for ActionDispatch::Request#key? [ci skip] Also made change after the review by @rafaelfranca . Update request.rb --ci skip Documentation for ActionDispatch::Request#key? [ci skip] Also made change after the review by @rafaelfranca . Update request.rb --ci skip
* Fix Rubocop violations and fix documentation visibilityRafael Mendonça França2016-12-281-1/+1
| | | | | | Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
* Optimize Journey::Route#scoreBen Hughes2016-12-282-5/+14
| | | | | | | | Scoring routes based on constraints repeated many type conversions that could be performed in the outer loop. Determinations of score and fitness also used Array operations that required allocations. Against my benchmark with a large routeset, this reduced object allocations by over 30x and wall time by over 3x.
* renderers typo fix [ci skip]ota42y2016-12-271-1/+1
|
* Shave a couple of allocations off Journey scan & parseMatthew Draper2016-12-253-203/+207
|
* Privatize unneededly protected methods in Action PackAkira Matsuda2016-12-2415-83/+82
|
* No need to nodoc private methodsAkira Matsuda2016-12-245-24/+24
|
* Describe what we are protectingAkira Matsuda2016-12-231-0/+2
|
* updating docsAaron Patterson2016-12-211-0/+4
|
* Document and update API for `skip_parameter_encoding`Aaron Patterson2016-12-215-23/+44
| | | | | | | | This commit changes `parameter_encoding` to `skip_parameter_encoding`. `skip_parameter_encoding` will set encoding on all parameters to ASCII-8BIT for a given action on a particular controller. This allows the controller to handle data when the encoding of that data is unknown, for example file systems or truly binary parameters.
* Merge pull request #27408 from matthewd/charset-fixMatthew Draper2016-12-202-4/+6
|\ | | | | Only default the response charset when it is first set
| * Only default the response charset when it is first setMatthew Draper2016-12-202-4/+6
| | | | | | | | | | If it is explicitly cleared (e.g., response.sending_file = true), then we should not try to set it again.
* | Merge pull request #27146 from maclover7/jm-fix-27145Eileen M. Uchitelle2016-12-191-2/+0
|\ \ | |/ |/| Do not clear HTTP_COOKIES header after request
| * Do not clear HTTP_COOKIES header after requestJon Moss2016-12-111-2/+0
| |
* | Missing require "active_support/testing/constant_lookup"Akira Matsuda2016-12-141-0/+1
|/
* Do not raise exception when content_type is a empty stringRafael Mendonça França2016-12-091-1/+1
| | | | | When content type header is blank we were raising an exception because `empty?` was being called on nil.
* Only move fixture_file_upload to IntegrationTestMatthew Draper2016-12-072-18/+22
| | | | | The rest of the helpers are better placed on Session -- and this is the only one that cares which class it is defined on.
* Do not try to set the content_type if the format is nilRafael Mendonça França2016-12-051-1/+1
|
* Document 'false' as option for 'action_on_unpermitted_parameters'Daniel Carral2016-11-291-2/+2
| | | | [ci skip]
* [ci skip] Update the `as` docs.Kasper Timm Hansen2016-11-271-1/+2
| | | | Mention the Accept header and how that figures into the request format.
* Remove default argument value.Kasper Timm Hansen2016-11-271-1/+1
| | | | Wrongly added when fixing the request path wrangling.
* Merge pull request #27140 from ↵Rafael França2016-11-251-1/+1
|\ | | | | | | | | supercaracal/fix-force-ssl-if-session-store-disabled Fix a force ssl redirection bug that occur when session store disabled.
| * Fix a force ssl redirection bug that occur when session store disabled.Taishi Kasuga2016-11-221-1/+1
| |
* | [ci skip] Explain only :json is shipped by default.Kasper Timm Hansen2016-11-231-1/+2
| | | | | | | | | | | | | | Don't want to add defensive programming to this fairly simple thing. Fixes #27060.
* | Use accept header instead of mangling request path.Kasper Timm Hansen2016-11-232-22/+19
|/ | | | | | | | | | | | | | Instead of appending a format to the request, it's much better to just pass a more appropriate accept header. Rails will figure out the format from that instead. This allows devs to use `:as` on routes that don't have a format. Introduce an `IdentityEncoder` to avoid `if request_encoder`, essentially a better version of the purpose of the `WWWFormEncoder`. One that makes conceptual sense on GET requests too. Fixes #27144.
* Revert "fix typo in `match` doc [ci skip]"Jon Moss2016-11-191-1/+1
|
* fix typo in `match` doc [ci skip]yuuji.yaginuma2016-11-201-1/+1
| | | | s/Constrains/Constraints
* Merge pull request #27089 from erickueen/erickueen_fix_26606Rafael Mendonça França2016-11-181-5/+5
|\ | | | | | | Fix incorrect output from rails routes when using singular resources …
| * Fix incorrect output from rails routes when using singular resources issue ↵Erick Reyna2016-11-181-5/+5
| | | | | | | | | | | | | | | | | | | | #26606 Rails routes (even rake routes in previous versions) output showed incorrect routes when an application use resource :controller, implying that edit_controller_path match with controller#show. The order of the output has changed to correct this. View #26606 for more information. Added a test case, change unit test in rake to expect the new output. Since the output of resource :controller is changing, the string spected of the railties/test/application/rake_test.rb test_rails_routes_with_controller_environment had to be modified.
* | Fix `ActionDispatch::IntegrationTest#open_session`Tawan Sierek2016-11-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reset a new session directly after its creation in `ActionDispatch::IntegrationTest#open_session`. Reset the session to a clean state before making it available to the client's test code. Issue #22742 reports unexpected behavior of integration tests that run multiple sessions. For example an `ActionDispatch::Flash` instance is shared across multiple sessions, though a client code will rightfully assume that each new session has its own flash hash. The following test failed due to this behavior: class Issue22742Test < ActionDispatch::IntegrationTest test 'issue #22742' do integration_session # initialize first session a = open_session b = open_session refute_same(a.integration_session, b.integration_session) end end Instead of creating a new `ActionDispatch::Integration::Session` instance, the same instance is shared across all newly opened test sessions. This is due to the way how new test sessions are created in `ActionDispatch::IntegrationTest#open_session`. The already existing `ActionDispatch::IntegrationTest` instance is duplicated with `Object#dup`, This approach was introduced in commit 15c31c7639b. `Object#dup` copies the instance variables, but not the objects they reference. Therefore this issue only occurred when the current test instance had been tapped in such a way that the instance variable `@integration_session` was initialized before creating the new test session. Close #22742 [Tawan Sierek + Sina Sadeghian]
* | Fixed CONTENT_LENGTH header in ActionController::TestRequestArtem Rashev2016-11-151-2/+3
|/ | | | | | | | | | | | | CONENT_LENGTH setted by string length, which is equal to number of characters in string but StringIO.length is byte sequence and when payload contains non-ASCII characters, stream's length will be different. That's why real byte length should be used for CONTENT_LENGTH header. Add unit test for CONTENT_LENGTH header fix It just passes non-ascii symbols as parameters and verifies that "CONTENT_LENGTH" header has content bytes count as value.
* Missing require string/filters for `squish`Akira Matsuda2016-11-151-0/+2
|
* Merge pull request #27007 from maclover7/jm-fix-26912Rafael Mendonça França2016-11-131-2/+2
|\ | | | | | | Don't error on an empty CONTENT_TYPE
| * Don't error on an empty CONTENT_TYPEJon Moss2016-11-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit prevents a possible issue wherein an empty CONTENT_TYPE header is sent in a request to a Rails application, and then `request.content_mime_type` would return `nil`. This is because the `has_content_type?` guard method was not properly checking the validity of a request's content type; it was only checking to see whether or not the header existed, not whether it had a value stored inside. Relatedly, after an internal discussion, it was determined that the `has_content_type?` method is not meant to be part of the public API, and is therefore changed to a `:nodoc:` method in this commit. The test for this behavior is a little bit ugly, for two reasons. One is that it was difficult to determine where to place the test... I figured the best place would be with the rest of the ParamsWrapper stuff, since that's where the original issue was. Also, we have to do some fancy footwork in calling `dispatch` on the test's controller manually... this is because `ActionController::TestCase` will throw an error if you try and pass in a nil content type, which is exactly what we are trying to test here... Because of that, we have to manually call in to the controller, and bypass the `post` request helper. Fixes #26912. This is a regression in behavior between Rails versions 4.2.x and 5.0.x, which was introduced via [this commit](https://github.com/rails/rails/commit/a9f28600e901b11a9222e34bfae8642bfb753186).
* | Merge pull request #26222 from vipulnsward/26134-fixRafael França2016-11-131-1/+5
|\ \ | | | | | | Format and send logs to logger.fatal from DebugExceptions
| * | Format and send logs to logger.fatal from DebugExceptions instead of calling ↵Vipul A M2016-11-121-1/+5
| | | | | | | | | | | | | | | | | | fatal multiple times. Expose tags_text from TaggedLogging to be used for log formatting Fixes #26134
* | | Merge pull request #26905 from bogdanvlviv/docsAndrew White2016-11-137-11/+11
|\ \ \ | | | | | | | | Add missing `+` around a some literals.
| * | | Add missing `+` around a some literals.bogdanvlviv2016-10-277-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | Mainly around `nil` [ci skip]
* | | | removes unconventional "then" in case expressionXavier Noria2016-11-131-1/+1
| | | |
* | | | revises style in recent code (of mine)Xavier Noria2016-11-131-5/+7
| |/ / |/| | | | | | | | | | | This alternative case expressions read better for my taste, and look more uniform in a file where other similar case expressions are used (without dynamic clauses).
* | | significant speedup of AC::Parameters#permitXavier Noria2016-11-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of AC::Parameters#permit builds permitted hashes and then calls permit! on them. This filtering is recursive, so we call permit! on terminal branches, but then ascendants call permit! on themselves when the recursion goes up the stack, which recurses all the way down again because permit! is recursive itself. Repeat this for every parent node and you get some scary O-something going on that I don't even want to compute. Instead, since the whole point of the permit recursion is to build permitted hashes along the way and at that point you know you've just come up with a valid filtered version, you can already switch the toggle on the spot. I have seen 2x speedups in casual benchmarks with small structures. As the previous description shows, the difference in performance is going to be a function of the nesting. Note that that the involved methods are private and used only by permit.
* | | adds a missing dot [ci skip]Xavier Noria2016-11-111-1/+1
| | |
* | | adds support for arbitrary hashes in strong parametersXavier Noria2016-11-111-0/+45
| | |
* | | Merge pull request #26820 from y-yagi/add_bang_merge_to_parametersRafael França2016-11-101-0/+7
|\ \ \ | |_|/ |/| | add `ActionController::Parameters#merge!`
| * | add `ActionController::Parameters#merge!`yuuji.yaginuma2016-10-181-0/+7
| | | | | | | | | | | | | | | This method has the same behavior as `Hash#merge!`, returns current `ActionController::Parameters`.