Module: Roda::RodaPlugins::Head::InstanceMethods

Defined in:
lib/roda/plugins/head.rb

Instance Method Summary collapse

Instance Method Details

#callObject

Always use an empty response body for head requests, with a content length of 0.



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/roda/plugins/head.rb', line 61

def call(*)
  res = super
  if @_request.head?
    body = res[2]
    if body.respond_to?(:close)
      res[2] = CloseLater.new(body)
    else
      res[2] = EMPTY_ARRAY
    end
  end
  res
end