From c15e8bdacb5d85b5ccfd154015473674fa8971dc Mon Sep 17 00:00:00 2001 From: Stormwind Date: Fri, 23 Nov 2012 19:35:14 +0100 Subject: Sets Content-Type header in to_a --- lib/zero/response.rb | 1 + spec/unit/response/response_spec.rb | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/zero/response.rb b/lib/zero/response.rb index b8aeff0..2660924 100644 --- a/lib/zero/response.rb +++ b/lib/zero/response.rb @@ -33,6 +33,7 @@ module Zero def to_a() # TODO Remove content length and body, on certain status codes # TODO Set content length, if not already set + content_length # TODO Set content type, if not already set [status, header, body] diff --git a/spec/unit/response/response_spec.rb b/spec/unit/response/response_spec.rb index e58b0d0..9f6a3a0 100644 --- a/spec/unit/response/response_spec.rb +++ b/spec/unit/response/response_spec.rb @@ -14,11 +14,16 @@ describe Zero::Response do value.should be_an_instance_of(Array) value[0].should eq(200) # Status code - value[1].should eq({}) # Headers + value[1].should eq({"Content-Length" => 0}) # Headers value[2].should eq([]) # Body end it "returns the content length in the header" do + subject.body = ['foobar'] + + value = subject.to_a + + value[1].should eq({'Content-Length' => 6}) # Headers end end -- cgit v1.2.3-70-g09d2