Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add send_data back in but deprecate [#143]

  • Loading branch information...
commit a9e9f00240358478f98cf3f98062a657c7b28d90 1 parent 090c4d7
Ryan Tomayko rtomayko authored
Showing with 14 additions and 1 deletion.
  1. +2 −0  CHANGES
  2. +1 −1  compat/streaming_test.rb
  3. +11 −0 lib/sinatra/compat.rb
2  CHANGES
View
@@ -20,6 +20,8 @@
* Fix that ERB templates were evaluated twice per "erb" call.
* The ERB output buffer is now available to helpers via the @_out_buf
instance variable.
+ * The request-level #send_data method from Sinatra 0.3.3 has been added
+ for compatibility but is deprecated.
= 0.9.0.4 / 2009-01-25
2  compat/streaming_test.rb
View
@@ -93,7 +93,7 @@
end
# Deprecated. send_data is going away.
- xspecify "should send the data with options" do
+ specify "should send the data with options" do
get '/' do
send_data 'asdf', :status => 500
end
11 lib/sinatra/compat.rb
View
@@ -106,6 +106,17 @@ def entity_tag(*args, &block)
etag(*args, &block)
end
+ # Deprecated. Use the #attachment helper and return the data as a String or
+ # Array.
+ def send_data(data, options={})
+ sinatra_warn "The 'send_data' method is deprecated. use attachment, status, content_type, etc. helpers instead."
+
+ status options[:status] if options[:status]
+ attachment options[:filename] if options[:disposition] == 'attachment'
+ content_type options[:type] if options[:type]
+ halt data
+ end
+
# Throwing halt with a Symbol and the to_result convention are
# deprecated. Override the invoke method to detect those types of return
# values.
Please sign in to comment.
Something went wrong with that request. Please try again.