Last Updated: July 25, 2019
· 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

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

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

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