lib/roda/plugins/drop_body.rb in roda-2.28.0 vs lib/roda/plugins/drop_body.rb in roda-2.29.0
- old
+ new
@@ -9,12 +9,13 @@
# not include a body (response statuses 100, 101, 102, 204, 205,
# and 304).
module DropBody
module ResponseMethods
DROP_BODY_STATUSES = [100, 101, 102, 204, 205, 304].freeze
- EMPTY_BODY = [].freeze
+ EMPTY_BODY = [].freeze
+ RodaPlugins.deprecate_constant(self, :EMPTY_BODY)
CONTENT_LENGTH = "Content-Length".freeze
RodaPlugins.deprecate_constant(self, :CONTENT_LENGTH)
CONTENT_TYPE = "Content-Type".freeze
RodaPlugins.deprecate_constant(self, :CONTENT_TYPE)
@@ -22,10 +23,10 @@
# returned, use an empty body and remove the Content-Length
# and Content-Type headers.
def finish
r = super
if DROP_BODY_STATUSES.include?(r[0])
- r[2] = EMPTY_BODY
+ r[2] = EMPTY_ARRAY
h = r[1]
h.delete("Content-Length")
h.delete("Content-Type")
end
r