You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Responses with HTTP status codes that should not have an entity bodySTATUS_WITH_NO_ENTITY_BODY=Set.new((100..199).to_a << 204 << 205 << 304)SYMBOL_TO_STATUS_CODE=Hash[*HTTP_STATUS_CODES.map{ |code,message|
[message.downcase.gsub(/\s|-|'/,'_').to_sym,code]}.flatten]defstatus_code(status)ifstatus.is_a?(Symbol)SYMBOL_TO_STATUS_CODE[status] || 500elsestatus.to_iendendmodule_function:status_code
Looking at Rack::Utils, I noticed:
Problem is
I propose to introduce a status_code! function that throws an error if it is invalid and does not just default to 500.
Would you guys accept a PR on that?
The text was updated successfully, but these errors were encountered: