aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/send_file_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Update send_file headers test to use mp4 as example instead of mpgGuillermo Iguaran2017-11-281-1/+1
|
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Define path with __dir__bogdanvlviv2017-05-231-1/+1
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Only default the response charset when it is first setMatthew Draper2016-12-201-1/+8
| | | | | If it is explicitly cleared (e.g., response.sending_file = true), then we should not try to set it again.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Add regression testsJon Moss2016-08-291-0/+14
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-17/+17
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-34/+34
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Use `#performed?` to terminate controller callbacksJeff Kreeftmeijer2016-06-031-0/+15
| | | | | | | | | | | | | | | Since 69009f, `ActionController::Metal::DataStreaming#send_file` doesn't set `@_response_body` anymore. `AbstractController::Callbacks` used `@_response_body` in its callback terminator, so it failed to halt the callback cycle when using `#send_file` from a `before_action`. Instead, it now uses `#performed?` on `AbstractController::Base` and `ActionController::Metal`, which checks `response.committed?`, besides checking if `@_response_body` is set, if possible. Example application: https://gist.github.com/jeffkreeftmeijer/78ae4572f36b198e729724b0cf79ef8e
* Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compatJeremy Daer2015-10-061-2/+2
| | | | | | | | | | | | | | | | | Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries that support multiple Rails versions would've had to feature-detect whether to use `Mime::Type[:FOO]` or `Mime::FOO`. `Mime[:foo]` has been around for ages to look up registered MIME types by symbol / extension, though, so libraries and plugins can safely switch to that without breaking backward- or forward-compatibility. Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup by type or extension, so it's not available as `Mime[:all]`. We use it internally as a wildcard for `respond_to` negotiation. If you use this internal constant, continue to reference it with `Mime::ALL`. Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
* 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
|