From b4e56c6868125af8e5c773140da0775a831779d2 Mon Sep 17 00:00:00 2001 From: Stormwind Date: Fri, 23 Nov 2012 17:59:33 +0100 Subject: Sets Content-Length to body string length It joins the body array to a string and sets the Content-Length header to its length. --- spec/unit/response/response_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/unit/response') diff --git a/spec/unit/response/response_spec.rb b/spec/unit/response/response_spec.rb index 0bb0c4e..21d6e31 100644 --- a/spec/unit/response/response_spec.rb +++ b/spec/unit/response/response_spec.rb @@ -53,6 +53,13 @@ describe Zero::Response do subject.header['Content-Length'].should eq(0) end + + it "sets the content_length to the size of the message body" do + subject.body = ['foo', 'bar'] + subject.content_length + + subject.header['Content-Length'].should eq(6) + end end end \ No newline at end of file -- cgit v1.2.3-70-g09d2