e4udlw
Last Updated: July 25, 2019
·
894
· rahmat-budiharso

HEAD response in padrino

With Ruby on Rails we can give HEAD response in a controller action easily

def index
  # some code
  head status: 201
end

With Padrino there's no head method, but we can as easily return HEAD response

get '/'
  # some code
  [204, {}, ['']]
end

That is in sequence, the response status, the headers hash, and the body. It's just a standard rack response object.