aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Merge pull request #23035 from jkowens/fix-null-byteRafael França2016-01-121-0/+4
|\ \ \ \ \ \ | | | | | | | | | | | | | | Prevent static middleware from attempting to serve a request with a null byte
| * | | | | | Prevent attempt to serve a request with a null byteJordan Owens2016-01-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | File paths cannot contain null byte characters and methods that do path operations such as Rack::Utils#clean_path_info will raise unwanted errors.
* | | | | | | AC::Parameters#at_json: restore Rails 4.2’s valueclaudiob2016-01-121-0/+6
| |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #23026 See discussion at #23026
* | | | | | Commit before freezing the headersMatthew Draper2016-01-121-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This shouldn't generally come up: under a standard flow, we don't start sending until after the commit. But application code always finds a way.
* | | | | | Merge pull request #21181 from denisenkom/mypatchKasper Timm Hansen2016-01-101-0/+19
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Test basic auth with symbols in password
| * | | | | Test basic auth with symbols in login and passwordMikhail Denisenko2015-10-241-0/+19
| | | | | |
* | | | | | Better error message when running `rake routes` with CONTROLLER arg:Edouard CHIN2016-01-071-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `CONTROLLER` argument can now be supplied in different ways (Rails::WelcomeController, Rails::Welcome, rails/welcome) - If `CONTROLLER` argument was supplied but it does not exist, will warn the user that this controller does not exist - If `CONTROLLER` argument was supplied and no routes could be found matching this filter, will warn the user that no routes were found matching the supplied filter - If no routes were defined in the config/routes.rb file, will warn the user with the original message
* | | | | | Remove splat operator warning from ssl_testPrathamesh Sonpatki2016-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Removes following warning - `rails/actionpack/test/dispatch/ssl_test.rb:203: warning: `*' interpreted as argument prefix`.
* | | | | | Allow AC::Parameters as an argument to url_helpersPrathamesh Sonpatki2016-01-071-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Earlier only Hash was allowed as params argument to url_helpers. - Now ActionController::Parameters instances will also be allowed. - If the params are not secured then it will raise an ArgumentError to indicate that constructing URLs with non-secure params is not recommended. - Fixes #22832.
* | | | | | Merge pull request #22275 from mastahyeti/per-form-csrfRafael França2016-01-061-0/+172
|\ \ \ \ \ \ | | | | | | | | | | | | | | Per-form CSRF tokens
| * | | | | | add option for per-form CSRF tokensBen Toews2016-01-041-0/+172
| | | | | | |
* | | | | | | Merge pull request #22906 from bf4/rendering_exceptionsRafael França2016-01-042-24/+90
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Add ActionController:Renderers test
| * | | | | | Add ActionController:Renderers testBenjamin Fleischer2016-01-032-24/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To complement actionpack/test/controller/metal/renderers_test.rb
* | | | | | | Fix typo in test desctiption [skip ci]Anton Davydov2016-01-041-1/+1
|/ / / / / /
* | / / / / Test ActionController::Renderers::use_renderersBenjamin Fleischer2015-12-312-0/+48
| |/ / / / |/| | | |
* | | | | Merge pull request #22850 from prathamesh-sonpatki/fix_ac_params_unsafe_h_2Kasper Timm Hansen2015-12-311-0/+8
|\ \ \ \ \ | | | | | | | | | | | | Fix AC::Parameters#to_unsafe_h to return all unfiltered values
| * | | | | Fix AC::Parameters#to_unsafe_h to return all unfiltered valuesPrathamesh Sonpatki2015-12-311-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - AC::Parameters#convert_parameters_to_hashes should return filtered or unfiltered values based on whether it is called from `to_h` or `to_unsafe_h` instead of always defaulting to `to_h`. - Fixes #22841
* | | | | | Merge pull request #22826 from timrogers/actiondispatch-ssl-configRafael França2015-12-311-15/+30
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | Configurable redirect and secure cookies for ActionDispatch::SSL
| * | | | | Flexible configuration for ActionDispatch::SSLTim Rogers2015-12-291-15/+30
| | |_|_|/ | |/| | |
* | | | | Fix test for AC::Parameters#to_unsafe_hPrathamesh Sonpatki2015-12-301-2/+2
| |/ / / |/| | | | | | | | | | | - Test should call `to_unsafe_h` instead of `to_h`
* | | | Merge pull request #22830 from jcoyne/parameters_includeRichard Schneeman2015-12-291-0/+6
|\ \ \ \ | | | | | | | | | | Add AC::Parameters#include?
| * | | | Add AC::Parameters#include?Justin Coyne2015-12-291-0/+6
| |/ / / | | | | | | | | | | | | Fixes #22818
* | | | Format from Accept headers have higher precedence than path extension formatJorge Bejar2015-12-291-0/+9
| | | |
* | | | Rely on default Mime format when MimeNegotiation#format_from_path_extension ↵Jorge Bejar2015-12-291-0/+12
|/ / / | | | | | | | | | | | | | | | is not a valid type Closes #22747
* | | Currectly test the Middleware#==Rafael Mendonça França2015-12-221-4/+8
| | |
* | | Add #== back to ActionDispatch::MiddlewareStack::MiddlewareJon Moss2015-12-211-0/+12
| |/ |/| | | | | | | This was causing bug #22738 to occur. Also added extra tests to make sure everything is A-OK.
* | Merge pull request #22650 from derekprior/dp-actionpack-warningsRafael França2015-12-181-0/+5
|\ \ | | | | | | Fix "instance variable not initialized" in tests
| * | Fix "instance variable not initialized" in testsDerek Prior2015-12-171-0/+5
| | | | | | | | | | | | | | | | | | | | | The ActionPack test suite had a handful of these warnings when run. This was due to `assert_response` being tested outside the context of a controller instance where those instance variables would already have been initialized.
* | | Merge pull request #20797 from byroot/prevent-url-for-ac-parametersRafael França2015-12-183-3/+10
|\ \ \ | |/ / |/| | Prevent ActionController::Parameters in url_for
| * | Prevent ActionController::Parameters from being passed to url_for directlyJean Boussier2015-12-153-3/+10
| | |
* | | Only dup Ruby's Hash and Array.Kasper Timm Hansen2015-12-171-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | When calling `to_h` on an `ActionController::Parameters` instance it would `deep_dup` its internal parameters. This inadvertently called `dup` on a passed Active Record model which would create new models. Fix by only dupping Ruby's Arrays and Hashes.
* | | Deprecate `redirect_to :back`Derek Prior2015-12-161-2/+15
| | | | | | | | | | | | | | | | | | | | | Applications that use `redirect_to :back` can be forced to 500 by clients that do not send the HTTP `Referer` (sic) header. `redirect_back` requires the user to consider this possibility up front and avoids this trivially-caused application error.
* | | Add `redirect_back` for safer referrer redirectsDerek Prior2015-12-161-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `redirect_to :back` is a somewhat common pattern in Rails apps, but it is not completely safe. There are a number of circumstances where HTTP referrer information is not available on the request. This happens often with bot traffic and occasionally to user traffic depending on browser security settings. When there is no referrer available on the request, `redirect_to :back` will raise `ActionController::RedirectBackError`, usually resulting in an application error. `redirect_back` takes a required `fallback_location` keyword argument that specifies the redirect when the referrer information is not available. This prevents 500 errors caused by `ActionController::RedirectBackError`.
* | | deletes code commented out in 72160d9fTony Ta2015-12-151-10/+0
| | |
* | | Merge pull request #14212 from tylerhunt/fix-token-regexSean Griffin2015-12-151-0/+8
|\ \ \ | | | | | | | | | | | | Handle tab in token authentication header.
| * | | Handle tab in token authentication header.Tyler Hunt2014-02-261-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The HTTP spec allows for LWS to precede the header content, which could include multiple SP and HT characters. Update the regex used to match the Token authorization header to account for this, instead of matching on a single SP. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html and http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html for the relevant parts of the specification.
* | | | Add fragment_cache_key macro for controller-wide fragment cache key prefixesSam Stephenson2015-12-141-0/+25
| | | |
* | | | Merge pull request #22564 from maximeg/legit_name_errorsSean Griffin2015-12-141-0/+41
|\ \ \ \ | | | | | | | | | | Don't catch all NameError to reraise as ActionController::RoutingError
| * | | | Don't catch all NameError to reraise as ActionController::RoutingError #22368Maxime Garcia2015-12-121-0/+41
| | |/ / | |/| |
* / | | Make Parameters#to_h and #to_unsafe_h return HWIAPrem Sichanugrist2015-12-141-4/+4
|/ / / | | | | | | | | | | | | | | | | | | This makes these two methods to be more inline with the previous behavior of Parameters as Parameters used to be inherited from HWIA. Fixes #21391
* | | Show redirect response code in assert_response messagesJon Atack2015-12-111-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up to PR #19977, which helpfully added the redirection path to the error message of assert_response if response is a redirection, but which removed the response code, obscuring the type of redirect. This PR: - brings back the response code in the error message, - updates the tests so the new messages can be tested, - and adds test cases for the change.
* | | Merge pull request #22514 from ↵Rafael França2015-12-111-2/+2
|\ \ \ | | | | | | | | | | | | | | | | prathamesh-sonpatki/use-assert-over-assert-predicate Use assert over assert_predicate in assert_response
| * | | Use assert over assert_predicate in assert_responsePrathamesh Sonpatki2015-12-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `assert_predicate` appends its own error message at the end of message generated by `assert_response` and because of that the error message displays the whole `response` object. - For eg. Expected response to be a <success>, but was a redirect to <http://test.host/posts>. Expected #<ActionDispatch::TestResponse:0x007fb1cc1cf6f8....(lambda)>}>> to be successful?. - Complete message can be found here - https://gist.github.com/prathamesh-sonpatki/055afb74b66108e71ded#file-gistfile1-txt-L19. - After this change the message from `assert_predicate` won't be displayed and only message generated by `assert_response` will be shown as follows: Expected response to be a <success>, but was a redirect to <http://test.host/posts>
* | | | Merge pull request #20831 from jmbejar/rails-api-json-error-responseSantiago Pastorino2015-12-093-5/+90
|\ \ \ \ | | | | | | | | | | Rails API: Ability to return error responses in json format also in development
| * | | | Do not add format key to request_paramsJorge Bejar2015-12-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I did this change but it is affecting how the request params end up after being processed by the router. To be in the safe side, I just take the format from the extension in the URL when is not present in those params and it's being used only for the `Request#formats` method
| * | | | DebugException initialize with a response_format valueJorge Bejar2015-12-091-2/+2
| | | | |
| * | | | Fix some edge cases in AD::DebugExceptions in rails api appsJorge Bejar2015-12-091-11/+62
| | | | |
| * | | | Response when error should be formatted properly in Rails API if local requestJorge Bejar2015-12-093-4/+25
| | | | |
| * | | | Use URL path extension as format in bad params exception handlingJorge Bejar2015-12-081-1/+15
| | | | |
* | | | | Fix `make_response!` when called by `serve` in `RouteSet`eileencodes2015-12-091-0/+39
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All of our tests were testing the `ActionController::Live` behavior in a standalone environment, without going through the router or behaving like a real application. This resulted in `ActionController::Live` throwing the exception `undefined method 'request' for #<ActionDispatch::Request:0x00000003ad1148>` because `make_response!` was expecting a response instead of a request. The expectation of a response came from `set_response!` in non-router tests setting the response and passing it to `make_response!`. In the case of an application we would hit `serve` in `RouteSet` first which would send us to `make_response!` with a request sent instead of a response. The changes here remove `set_response!` so `make_response!` always receives a request. Thanks to KalabiYau for help with the investigation and solution. Fixes #22524 [Eileen M. Uchitelle & KalabiYau]