aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing/test_response.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/testing/test_response.rb')
-rw-r--r--actionpack/lib/action_dispatch/testing/test_response.rb18
1 files changed, 6 insertions, 12 deletions
diff --git a/actionpack/lib/action_dispatch/testing/test_response.rb b/actionpack/lib/action_dispatch/testing/test_response.rb
index c5464f1559..c35982e075 100644
--- a/actionpack/lib/action_dispatch/testing/test_response.rb
+++ b/actionpack/lib/action_dispatch/testing/test_response.rb
@@ -93,6 +93,12 @@ module ActionDispatch
ActiveSupport::Deprecation.warn("response.has_template_object? has been deprecated. Use tempate.assigns[name].nil? instead", caller)
!template_objects[name].nil?
end
+
+ # Returns binary content (downloadable file), converted to a String
+ def binary_content
+ ActiveSupport::Deprecation.warn("response.binary_content has been deprecated. Use response.body instead", caller)
+ body
+ end
end
include DeprecatedHelpers
@@ -121,17 +127,5 @@ module ActionDispatch
def client_error?
(400..499).include?(response_code)
end
-
- # Returns binary content (downloadable file), converted to a String
- def binary_content
- raise "Response body is not a Proc: #{body_parts.inspect}" unless body_parts.kind_of?(Proc)
- require 'stringio'
-
- sio = StringIO.new
- body_parts.call(self, sio)
-
- sio.rewind
- sio.read
- end
end
end