Module: Rack::App::InstanceMethods::HTTPStatus

Included in:
Rack::App::InstanceMethods
Defined in:
lib/rack/app/instance_methods/http_status.rb

Instance Method Summary collapse

Instance Method Details

#http_status!(code, desc = nil) ⇒ Object



3
4
5
6
7
8
# File 'lib/rack/app/instance_methods/http_status.rb', line 3

def http_status!(code, desc=nil)
  raise unless code.is_a?(Integer)
  response.status = code
  response.write(desc || Rack::App::Constants::HTTP_STATUS_CODES[code] || raise)
  finish!
end