Sha256: 54fb1c3ed8aead6967e37f28df8200b8b0a82a724b0a1cba587953414e876f31
Contents?: true
Size: 831 Bytes
Versions: 19
Compression:
Stored size: 831 Bytes
Contents
# frozen-string-literal: true class Roda module RodaPlugins # The symbol_status plugin patches the +status=+ response method to # accept the status name as a symbol. If given an integer value, # the default behaviour is used. # # Examples: # r.is "needs_authorization" # response.status = :unauthorized # end # r.is "nothing" # response.status = :no_content # end # # The conversion is done through <tt>Rack::Utils.status_code</tt>. module SymbolStatus module ResponseMethods # Sets the response status code by fixnum or symbol name def status=(code) code = Rack::Utils.status_code(code) if code.is_a?(Symbol) super(code) end end end register_plugin(:symbol_status, SymbolStatus) end end
Version data entries
19 entries across 19 versions & 1 rubygems