Module: Roda::RodaPlugins::DropBody::ResponseMethods
- Defined in:
- lib/roda/plugins/drop_body.rb
Constant Summary collapse
- DROP_BODY_STATUSES =
[100, 101, 102, 204, 205, 304].freeze
Instance Method Summary collapse
-
#finish ⇒ Object
If the response status indicates a body should not be returned, use an empty body and remove the Content-Length and Content-Type headers.
Instance Method Details
#finish ⇒ Object
If the response status indicates a body should not be returned, use an empty body and remove the Content-Length and Content-Type headers.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/roda/plugins/drop_body.rb', line 21 def finish r = super case r[0] when 100, 101, 102, 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") end r end |