Should ActionController::Head#head validate the status?

17 views
Skip to first unread message

Avand Amiri

unread,
May 3, 2016, 4:10:09 AM5/3/16
to Ruby on Rails: Core
As I was writing a controller action with Rails 5, I had to respond with an empty successful response. In the past, I simply did render nothing: true. To achieve the same result without the deprecation warning I had to switch to using the head method. No problem, but my first instinct was to supply :success as the status, which caused the server to respond with an "Internal Server Error" with no stack trace, which was confusing. It took me 5-10 minutes to realize I was using the wrong status code. I switched to :ok and the problem went away.

Would it make sense for the head method attempt to validate that a valid status code is being passed in?
Reply all
Reply to author
Forward
0 new messages