aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/send_file_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* move file sending to the response objectAaron Patterson2015-10-051-1/+1
| | | | | | | Just a slight refactor that delegates file sending to the response object. This gives us the advantage that if a webserver (in the future) provides a response object that knows how to do accelerated file serving, it can implement this method.
* stop directly setting headers on the controllerAaron Patterson2015-09-231-9/+1
| | | | | again, since we are going through the test harness, all this is done for us.
* test against controller responsesAaron Patterson2015-09-231-52/+65
| | | | | | rather than calling methods on the controller. We should test the values returned by the controller rather than assuming that the internals are implemented in a certain way.
* stop calling deprecated methodsAaron Patterson2015-09-211-2/+2
| | | | | We should be asking the mime type method for the mime objects rather than via const lookup
* Added test for `send_file_headers` called with nil content typeRonak Jangir2015-09-191-1/+12
|
* let the superclass build the request and responseAaron Patterson2015-07-081-2/+0
| | | | | We should leverage the request / response objects that the superclass has already allocated for us.
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Prevent state leak.Guo Xiang Tan2014-06-051-0/+1
|
* Mime::PNG is already defined.Zuhao Wan2014-06-051-6/+0
|
* Unregister Mime::Type in teardown.Zuhao Wan2014-05-281-2/+6
|
* Remove redundant tests method.Guo Xiang Tan2014-05-111-2/+0
|
* Remove tests method for test cases when controller can be inferred.Guo Xiang2014-05-031-1/+0
|
* Merge branch 'master' into laurocaetano-fix_send_fileAaron Patterson2014-01-101-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (536 commits) doc, API example on how to use `Model#exists?` with multiple IDs. [ci skip] Restore DATABASE_URL even if it's nil in connection_handler test [ci skip] - error_messages_for has been deprecated since 2.3.8 - lets reduce any confusion for users Ensure Active Record connection consistency Revert "ask the fixture set for the sql statements" Check `respond_to` before delegation due to: https://github.com/ruby/ruby/commit/d781caaf313b8649948c107bba277e5ad7307314 Adding Hash#compact and Hash#compact! methods MySQL version 4.1 was EOL on December 31, 2009 We should at least recommend modern versions of MySQL to users. clear cache on body close so that cache remains during rendering add a more restricted codepath for templates fixes #13390 refactor generator tests to use block form of Tempfile Fix typo [ci skip] Move finish_template as the last public method in the generator Minor typos fix [ci skip] make `change_column_null` reversible. Closes #13576. create/drop test and development databases only if RAILS_ENV is nil Revert "Speedup String#to" typo fix in test name. [ci skip]. `core_ext/string/access.rb` test what we are documenting. Fix typo in image_tag documentation ... Conflicts: actionpack/CHANGELOG.md
| * Move the null mime type to request.formatCarlos Antonio da Silva2013-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TLDR: always return an object that responds to the query methods from request.format, and do not touch Mime::Type[] lookup to avoid bugs. --- Long version: The initial issue was about being able to do checks like request.format.html? for request with an unknown format, where request.format would be nil. This is where the issue came from at first in #7837 and #8085 (merged in cba05887dc3b56a46a9fe2779b6b228880b49622), but the implementation went down the path of adding this to the mime type lookup logic. This unfortunately introduced subtle bugs, for instance in the merged commit a test related to send_file had to be changed to accomodate the introduction of the NullType. Later another bug was found in #13064, related to the content-type being shown as #<Mime::NullType:...> for templates with localized extensions but no format included. This one was fixed in #13133, merged in 43962d6ec50f918c9970bd3cd4b6ee5c7f7426ed. Besides that, custom handlers were not receiving the proper template formats anymore when passing through the rendering process, because of the NullType addition. That was found while migrating an application from 3.2 to 4.0 that uses the Markerb gem (a custom handler that generates both text and html emails from a markdown template). --- This changes the implementation moving away from returning this null object from the mime lookup, and still fixes the initial issue where request.format.zomg? would raise an exception for unknown formats due to request.format being nil.
* | Fix stream closing when sending file with `ActionController::Live` included.Lauro Caetano2013-11-301-0/+14
|/ | | | Fixes #12381
* return Mime::NullType if format is unknownAngelo Capilleri2012-12-221-1/+1
| | | | | | | | | | If a request has an unknown format, the methods html?, xml?, json? ...etc not raise an Exception. This patch add a class Mime::NullType, that is returned when request.format is unknown and it responds false to the methods that ends with '?' and true to 'nil?'. It refers to #7837, this issue is considered a improvement not a bug.
* Accept symbols as #send_data :disposition valueElia Schito2012-11-271-0/+12
|
* cleanup, remove trailing whitespace within actionpackYves Senn2012-10-271-1/+1
|
* flushing output should write to the stream rather than mutating the response ↵Aaron Patterson2012-07-291-3/+3
| | | | object
* allow send_file/send_data to skip disposition header, closes #2973Sergey Nartimov2012-04-301-0/+11
|
* Remove unused methodSantiago Pastorino2012-03-121-4/+0
|
* remove checks for encodings availabilitySergey Nartimov2011-12-251-1/+1
|
* Make send_file guess content-type from file extension, if type wasn't ↵Esad Hajdarevic2011-06-281-0/+19
| | | | supplied (Issue #1847). Update tests & documentation.
* Use assert_respond_to because it has better error messagingNeeraj Singh2010-05-181-2/+2
| | | | | | [#4628 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Action Pack: fix tests with -K*, work around Ruby 1.9.1 constant lookup.Cezary Baginski2010-04-251-2/+2
| | | | | | [#4473 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Makes send_file work again by deferring to Rack::Sendfile. Carlhuda2010-02-231-23/+0
| | | | | | | | | | * Add the Rack::Sendfile middleware * Make the header to use configurable via config.action_dispatch.x_sendfile_header (default to "X-Sendfile"). * Add Railties tests to confirm that these work * Remove the :stream, :buffer_size, and :x_senfile default options to send_file * Change the log subscriber to always say "Sent file" * Add deprecation warnings for options that are now no-ops Note that servers can configure this by setting X-Sendfile-Type. Hosting companies and those creating packages of servers specially designed for Rails applications are encouraged to specify this header so that this can work transparently.
* Fix streaming by having it create a File object, which can be handled by ↵Carlhuda2010-02-231-3/+11
| | | | Rack servers as appropriate
* Fix a bunch of pending tests by providing an introspection mode for the ↵Carlhuda2010-02-191-2/+1
| | | | Response object that does up-front parsing of the headers to populate things like @etag
* Reinstate pending tests that were supposed to be fixed before theJoshua Peek2010-02-191-13/+11
| | | | | | beta. Shout louder this time so they actually get fixed.
* Update cache_control to be a Hash of options that is used to build the header.Yehuda Katz2009-08-021-1/+1
| | | | * Significantly simplifies setting and modifying cache control in other areas
* Ruby 1.9: fix encoding for test_file_streamJeremy Kemper2009-08-011-1/+2
|
* Ruby 1.9: fix Content-Length for multibyte send_data streamingSava Chankov2009-08-011-0/+12
| | | | | | [#2661 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* send_data should set Content-Length as a stringJoshua Peek2009-06-251-1/+1
|
* Cleaning up more tests and code that needed to work in both old and new baseYehuda Katz + Carl Lerche2009-06-171-2/+2
|
* Finish making things pass with updated internal content_type semanticsYehuda Katz + Carl Lerche2009-06-151-6/+4
|
* Add HTTP Authentication to the new basePratik Naik2009-05-221-4/+9
|
* Add Streaming to new basePratik Naik2009-05-211-11/+13
|
* Functional test runner finalizes response just like the integration test ↵Joshua Peek2009-05-021-4/+4
| | | | | runner. In both runners, the @response object will now behave the same. Some functional tests will need to be updated if they are relying on preprocessed data on the response.
* Bring abstract_controller up to date with rails/masterCarl Lerche & Yehuda Katz2009-04-131-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolved all the conflicts since 2.3.0 -> HEAD. Following is a list of commits that could not be applied cleanly or are obviated with the abstract_controller refactor. They all need to be revisited to ensure that fixes made in 2.3 do not reappear in 3.0: 2259ecf368e6a6715966f69216e3ee86bf1a82a7 AR not available * This will be reimplemented with ActionORM or equivalent 06182ea02e92afad579998aa80144588e8865ac3 implicitly rendering a js response should not use the default layout [#1844 state:resolved] * This will be handled generically 893e9eb99504705419ad6edac14d00e71cef5f12 Improve view rendering performance in development mode and reinstate template recompiling in production [#1909 state:resolved] * We will need to reimplement rails-dev-boost on top of the refactor; the changes here are very implementation specific and cannot be cleanly applied. The following commits are implicated: 199e750d46c04970b5e7684998d09405648ecbd4 3942cb406e1d5db0ac00e03153809cc8dc4cc4db f8ea9f85d4f1e3e6f3b5d895bef6b013aa4b0690 e3b166aab37ddc2fbab030b146eb61713b91bf55 ae9f258e03c9fd5088da12c1c6cd216cc89a01f7 44423126c6f6133a1d9cf1d0832b527e8711d40f 0cb020b4d6d838025859bd60fb8151c8e21b8e84 workaround for picking layouts based on wrong view_paths [#1974 state:resolved] * The specifics of this commit no longer apply. Since it is a two-line commit, we will reimplement this change. 8c5cc66a831aadb159f3daaffa4208064c30af0e make action_controller/layouts pick templates from the current instance's view_paths instead of the class view_paths [#1974 state:resolved] * This does not apply at all. It should be trivial to apply the feature to the reimplemented ActionController::Base. 87e8b162463f13bd50d27398f020769460a770e3 fix HTML fallback for explicit templates [#2052 state:resolved] * There were a number of patches related to this that simply compounded each other. Basically none of them apply cleanly, and the underlying issue needs to be revisited. After discussing the underlying problem with Koz, we will defer these fixes for further discussion.
| * Return body parts directly to Rack rather than building a response string ↵Jeremy Kemper2009-03-121-2/+2
| | | | | | | | ourselves. Allows Rack middleware to orchestrate response building.
| * Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-1/+1
| | | | | | | | [#1617 state:resolved]
* | Reorganize ActionController folder structureJoshua Peek2009-01-271-1/+1
|/
* Include process methods in ActionController::TestCase only. No need to ↵Jeremy Kemper2009-01-071-1/+2
| | | | alias_method_chain :process either.
* Allow use of symbols for :type option of ↵=?utf-8?q?Adam=20Cig=C3=A1nek?=2008-12-211-0/+25
| | | | | | ActionController::Streaming#send_file/#send_data [#1232 state:resolved] Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
* Use status response accessor instead of the 'Status' headerJoshua Peek2008-12-191-2/+2
|
* Do not output an ETag header if response body is blank or when sending files ↵Hongli Lai (Phusion2008-12-161-0/+1
| | | | | | with send_file(... :xsendfile => true) [#1578 state:committed] Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
* Set global ActionController::Base.view_paths for test casesJoshua Peek2008-07-121-2/+0
|
* Set precompiled fixture load path constant to speed up testsJoshua Peek2008-06-251-3/+1
|
* Introduce send_file :x_sendfile => true to send an X-Sendfile response header.Jeremy Kemper2008-01-111-2/+13
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8628 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* require abstract_unit directly since test is in load pathJeremy Kemper2008-01-051-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8564 5ecf4fe2-1ee6-0310-87b1-e25e094e27de