lib/roda/plugins/drop_body.rb in roda-3.53.0 vs lib/roda/plugins/drop_body.rb in roda-3.54.0
- old
+ new
@@ -13,25 +13,26 @@
module DropBody
module ResponseMethods
DROP_BODY_STATUSES = [100, 101, 102, 204, 205, 304].freeze
RodaPlugins.deprecate_constant(self, :DROP_BODY_STATUSES)
+ DROP_BODY_RANGE = 100..199
+ private_constant :DROP_BODY_RANGE
+
# If the response status indicates a body should not be
# returned, use an empty body and remove the Content-Length
# and Content-Type headers.
def finish
r = super
case r[0]
- when 100, 101, 102, 204, 304
+ when DROP_BODY_RANGE, 204, 304
r[2] = EMPTY_ARRAY
h = r[1]
h.delete("Content-Length")
h.delete("Content-Type")
when 205
r[2] = EMPTY_ARRAY
- h = r[1]
- h["Content-Length"] = '0'
- h.delete("Content-Type")
+ empty_205_headers(r[1])
end
r
end
end
end