diff options
author | Chris Wanstrath <chris@ozmm.org> | 2009-11-17 13:02:04 +0800 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-02 03:15:24 +0800 |
commit | 8b71767d1934bec6eb4afeb69bfad36414e4947b (patch) | |
tree | b61ad4f317ede1956205bdd4259575468a4e05c3 | |
parent | adf996587aecdd604eff441b8b69e4c47a8c2617 (diff) | |
download | rack-8b71767d1934bec6eb4afeb69bfad36414e4947b.tar.gz |
Response should call #to_i on the status, as per the spec.
"The status, if parsed as integer (to_i), must be greater than or equal to 100."
-rw-r--r-- | lib/rack/response.rb | 2 | ||||
-rw-r--r-- | test/spec_rack_response.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/rack/response.rb b/lib/rack/response.rb index d1f6a123..92c8c4a6 100644 --- a/lib/rack/response.rb +++ b/lib/rack/response.rb @@ -19,7 +19,7 @@ module Rack attr_accessor :length def initialize(body=[], status=200, header={}, &block) - @status = status + @status = status.to_i @header = Utils::HeaderHash.new({"Content-Type" => "text/html"}. merge(header)) diff --git a/test/spec_rack_response.rb b/test/spec_rack_response.rb index eb59b5c2..7989013d 100644 --- a/test/spec_rack_response.rb +++ b/test/spec_rack_response.rb @@ -118,6 +118,9 @@ context "Rack::Response" do r = Rack::Response.new([], 500) r.status.should.equal 500 + + r = Rack::Response.new([], "200 OK") + r.status.should.equal 200 end specify "has a constructor that can take a block" do |