From 8b71767d1934bec6eb4afeb69bfad36414e4947b Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Tue, 17 Nov 2009 13:02:04 +0800 Subject: 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." --- lib/rack/response.rb | 2 +- test/spec_rack_response.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-24-ge0c7