diff options
author | Matt Kasa <mkasa@baent.net> | 2014-03-07 19:37:41 -0800 |
---|---|---|
committer | Matt Kasa <mkasa@baent.net> | 2014-03-07 19:37:41 -0800 |
commit | 7fe910e0063388e2f636724925bd5f8b9905cc89 (patch) | |
tree | 4a00bb694b9b9f344706a7ac9caf879c7c174367 | |
parent | ce4a3959a5be68684c447ce68c626d0cc84f8c1a (diff) | |
download | rack-7fe910e0063388e2f636724925bd5f8b9905cc89.tar.gz |
Add support for RFC2324 status code
-rw-r--r-- | lib/rack/utils.rb | 3 | ||||
-rw-r--r-- | test/spec_response.rb | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb index 6c2bf907..28e0ded6 100644 --- a/lib/rack/utils.rb +++ b/lib/rack/utils.rb @@ -587,6 +587,7 @@ module Rack 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', @@ -611,7 +612,7 @@ module Rack STATUS_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] + [message.downcase.gsub(/\s|-|'/, '_').to_sym, code] }.flatten] def status_code(status) diff --git a/test/spec_response.rb b/test/spec_response.rb index 031488bb..6b13c0c9 100644 --- a/test/spec_response.rb +++ b/test/spec_response.rb @@ -251,6 +251,11 @@ describe Rack::Response do res.should.be.client_error res.should.be.method_not_allowed + res.status = 418 + res.should.not.be.successful + res.should.be.client_error + res.should.be.i_m_a_teapot + res.status = 422 res.should.not.be.successful res.should.be.client_error |