aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/mime_responds_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* cleanup, remove trailing whitespace within actionpackYves Senn2012-10-271-1/+1
|
* removes usage of Object#in? from the code base (the method remains defined ↵Xavier Noria2012-08-061-4/+5
| | | | | | | | | | | | | | | | | | | by Active Support) Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
* Collapsed dual checks (one for content headers and one for content) into a ↵Armand du Plessis2012-08-021-4/+4
| | | | | | | | | | | | single check. Rails includes a single character body to a head(:no_content) response to work around an old Safari bug where headers were ignored if no body sent. This patch brings the behavior slightly closer to spec if :no_content/204 is explicity requested via a head only response. Status comparison done on symbolic and numeric values Not returning any content when responding with head and limited to a status code that explicitly states no content will be returned - 100..199, 204, 205, 304.
* load active_support/core_ext/object/inclusion in active_support/railsXavier Noria2012-08-021-1/+0
|
* Prevent conflict between mime types and Object methodsMircea Pricop2012-07-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | Assuming the type ":touch", Collector.new was calling send(:touch), which instead of triggering method_missing and generating a new collector method, actually invoked the private method `touch` inherited from Object. By generating the method for each mime type as it is registered, the private methods on Object can never be reached by `send`, because the `Collector` will have them before `send` is called on it. To do this, a callback mechanism was added to Mime::Type This allows someone to add a callback for whenever a new mime type is registered. The callback then gets called with the new mime as a parameter. This is then used in AbstractController::Collector to generate new collector methods after each mime is registered.
* Raise a rescuable exception when Rails doesn't know what to do with the ↵Steven Soroka2012-05-061-13/+19
| | | | format, rather than responding with a head :not_acceptable (406)
* Remove default match without specified methodJose and Yehuda2012-04-241-1/+1
| | | | | | | | | | | | | | | | In the current router DSL, using the +match+ DSL method will match all verbs for the path to the specified endpoint. In the vast majority of cases, people are currently using +match+ when they actually mean +get+. This introduces security implications. This commit disallows calling +match+ without an HTTP verb constraint by default. To explicitly match all verbs, this commit also adds a :via => :all option to +match+. Closes #5964
* Add test case for #5307Carlos Antonio da Silva2012-03-071-2/+6
|
* Failing test for mime responder respond_with using a block.Mario Visic2012-03-051-0/+36
|
* Add config.default_method_for_update to support PATCHDavid Lee2012-02-221-0/+35
| | | | | | | | | | | | | | | | PATCH is the correct HTML verb to map to the #update action. The semantics for PATCH allows for partial updates, whereas PUT requires a complete replacement. Changes: * adds config.default_method_for_update you can set to :patch * optionally use PATCH instead of PUT in resource routes and forms * adds the #patch verb to routes to detect PATCH requests * adds #patch? to Request * changes documentation and comments to indicate support for PATCH This change maintains complete backwards compatibility by keeping :put as the default for config.default_method_for_update.
* Fix override API response bug in respond_withPrem Sichanugrist2012-02-031-0/+25
| | | | | | | | | | Default responder was only using the given respond block when user requested for HTML format, or JSON/XML format with valid resource. This fix the responder so that it will use the given block regardless of the validity of the resource. Note that in this case you'll have to check for object's validity by yourself in the controller. Fixes #4796
* Remove rescue_action from compatibility module and testsCarlos Antonio da Silva2012-01-171-5/+1
|
* Responders now return 204 No Content for API requests without a response ↵José Valim2011-10-261-10/+10
| | | | body (as in the new scaffold)
* ActionPack test fix for RBXArun Agrawal2011-10-241-1/+3
|
* Support symbol and string actions in AC#respond_to optionsAlexey Vakhov2011-10-111-1/+1
|
* JSON responder should return errors with :error rootDenis Odorcic2011-10-101-0/+26
|
* provide a more explicit message when using url_for with nilDamien Mathieu2011-07-021-0/+7
| | | This fixes the problem of having a non-explicit message when the :location option is not provided in respond_with.
* Make sure respond_with with :js tries to render a template in all casesJosé Valim2011-06-301-6/+15
|
* don't raise an exception if the format isn't recognizeddmathieu2011-05-261-0/+6
| | | | Fixed while traveling to heuruko
* Remove `#among?` from Active SupportPrem Sichanugrist2011-04-131-1/+1
| | | | | | After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now. It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
* removes the RJS template handlerXavier Noria2011-04-131-28/+1
|
* Change Object#either? to Object#among? -- thanks to @jamesarosen for the ↵David Heinemeier Hansson2011-04-121-1/+1
| | | | suggestion!
* Using Object#in? and Object#either? in various placesPrem Sichanugrist2011-04-111-1/+2
| | | | There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
* pass respond_with options to controller render when using a template for api ↵Josh Kalderimis2011-03-311-0/+19
| | | | | | navigation Signed-off-by: José Valim <jose.valim@gmail.com>
* only try to display an api template in responders if the request is a get or ↵Josh Kalderimis2011-03-311-0/+21
| | | | | | there are no errors Signed-off-by: José Valim <jose.valim@gmail.com>
* when using respond_with with an invalid resource and custom options, the ↵Josh Kalderimis2011-03-311-0/+17
| | | | | | default response status and error messages should be returned Signed-off-by: José Valim <jose.valim@gmail.com>
* fixing wrong testAaron Patterson2011-01-171-1/+1
|
* A bunch of cleanup on the inherited template patchwycats2010-12-261-1/+1
|
* Fix tests on 1.9.2.José Valim2010-11-281-7/+9
|
* If a user wants json output then try best to render json output. In such ↵Neeraj Singh2010-11-241-0/+18
| | | | | | | | cases prefer kind_of(String) over respond_to?(to_str) [#5841 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* clean up test by using unregister methodNeeraj Singh2010-11-251-12/+6
|
* Remove the not needed setup and teardownNeeraj Singh2010-11-251-3/+0
|
* move the mime registration code to setup so thatNeeraj Singh2010-11-221-2/+19
| | | | | | | | | | | | | | | it could be cleaned up on teardown. Currently the test code test/controller/mime_responds_test.rb impacts test/dispatch/mime_type_test.rb. dispatch/mime_type_test.rb runs independently fine but when run as part of rake breaks because of new mime types registered in controller/mime_responds_test.rb Signed-off-by: José Valim <jose.valim@gmail.com>
* do not assume that there is no space betweenNeeraj Singh2010-11-221-0/+4
| | | | | | leading */* and comma Signed-off-by: José Valim <jose.valim@gmail.com>
* failing test for #6022Neeraj Singh2010-11-221-0/+34
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* current code ignores http header "Accept" if itNeeraj Singh2010-11-221-0/+6
| | | | | | | | | | | has ....,*/* . It is possible to a device to send request such that */* appear at the beginning of the "Accept" header. This patch ensures that "Accept" header is ignored for such cases too. Signed-off-by: José Valim <jose.valim@gmail.com>
* Correctly handle the case of an API response that returns a hash by treating ↵Chris Eppstein2010-11-061-0/+16
| | | | a single hash argument as the resource instead of as options.
* Return a valid empty JSON on successful PUT and DELETE requests. [#5199 ↵Szymon Nowak2010-10-121-0/+19
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Use parentheses when using assert_match followed by a regexp to avoid warnings.Emilio Tagua2010-09-271-2/+2
|
* Removed deprecated RouteSet API, still many tests failPiotr Sarnacki2010-09-051-1/+1
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-5/+5
| | | | 's/[ \t]*$//' -i {} \;)
* Adds tests for content negotiation change introduced in dc5300adb6d46252c26ePatrik Stenmark2010-07-041-0/+20
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Fix a bug where responders were not working properly on method override.José Valim2010-05-241-0/+13
|
* Added missing requireSantiago Pastorino2010-04-161-0/+1
|
* Fixed a bunch of tests that failed in 1.9 because they assumed that a Rack ↵wycats2010-03-191-1/+1
| | | | response was a String.
* ActionController::Base.use_accept_header is not actually used anymore, so ↵Carl Lerche2010-03-031-4/+0
| | | | let's deprecate it.
* Require persisted? in ActiveModel::Lint and remove new_record? and ↵José Valim2010-02-211-2/+2
| | | | destroyed? methods. ActionPack does not care if the resource is new or if it was destroyed, it cares only if it's persisted somewhere or not.
* Improve missing template error messages a little bit.José Valim2010-01-311-1/+1
|
* Raise an error if respond_with is invoked and no format is declared.José Valim2010-01-101-68/+62
|
* Merge branch 'master' of github.com:rails/railsYehuda Katz2009-12-101-3/+5
|\