diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-22 16:08:03 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-22 16:08:03 -0600 |
commit | a1bf2f96ce6f086de8519e344ee7e396ae3da9bb (patch) | |
tree | 3c3a300bb56ec47dca0bc2b2d0379b33e295524e /actionpack/lib/action_dispatch/http | |
parent | 17b6053083767e5747c0f522b83a69e268d9d69e (diff) | |
download | rails-a1bf2f96ce6f086de8519e344ee7e396ae3da9bb.tar.gz rails-a1bf2f96ce6f086de8519e344ee7e396ae3da9bb.tar.bz2 rails-a1bf2f96ce6f086de8519e344ee7e396ae3da9bb.zip |
AD::StatusCodes support is now part of rack
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r-- | actionpack/lib/action_dispatch/http/response.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/http/status_codes.rb | 33 |
2 files changed, 2 insertions, 35 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 6dc563264f..8524bbd993 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -60,7 +60,7 @@ module ActionDispatch # :nodoc: end def status=(status) - @status = ActionDispatch::StatusCodes[status] + @status = Rack::Utils.status_code(status) end # The response code of the request @@ -74,7 +74,7 @@ module ActionDispatch # :nodoc: end def message - StatusCodes::STATUS_CODES[@status] + Rack::Utils::HTTP_STATUS_CODES[@status] end alias_method :status_message, :message diff --git a/actionpack/lib/action_dispatch/http/status_codes.rb b/actionpack/lib/action_dispatch/http/status_codes.rb deleted file mode 100644 index 3d6ee685ea..0000000000 --- a/actionpack/lib/action_dispatch/http/status_codes.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'active_support/inflector' - -module ActionDispatch - module StatusCodes #:nodoc: - STATUS_CODES = Rack::Utils::HTTP_STATUS_CODES.merge({ - 102 => "Processing", - 207 => "Multi-Status", - 226 => "IM Used", - 422 => "Unprocessable Entity", - 423 => "Locked", - 424 => "Failed Dependency", - 426 => "Upgrade Required", - 507 => "Insufficient Storage", - 510 => "Not Extended" - }).freeze - - def self.[](status) - if status.is_a?(Symbol) - SYMBOL_TO_STATUS_CODE[status] || 500 - else - status.to_i - end - end - - # Provides a symbol-to-fixnum lookup for converting a symbol (like - # :created or :not_implemented) into its corresponding HTTP status - # code (like 200 or 501). - SYMBOL_TO_STATUS_CODE = STATUS_CODES.inject({}) { |hash, (code, message)| - hash[ActiveSupport::Inflector.underscore(message.gsub(/ /, "")).to_sym] = code - hash - }.freeze - end -end |