From a2e6c299cd15b8335441e3b5ba07fe95256f3a2d Mon Sep 17 00:00:00 2001 From: Stormwind Date: Fri, 23 Nov 2012 18:06:53 +0100 Subject: Sets Content-Length to body string bytesize Sets the Conten-Length to the bytesize of the joined body to cover UTF-8 --- spec/unit/response/response_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec') diff --git a/spec/unit/response/response_spec.rb b/spec/unit/response/response_spec.rb index 21d6e31..e58b0d0 100644 --- a/spec/unit/response/response_spec.rb +++ b/spec/unit/response/response_spec.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 require 'spec_helper' describe Zero::Response do @@ -60,6 +61,13 @@ describe Zero::Response do subject.header['Content-Length'].should eq(6) end + + it "sets the content_length to the bytesize of the message body" do + subject.body = ['föö', 'bär'] + subject.content_length + + subject.header['Content-Length'].should eq(9) + end end end \ No newline at end of file -- cgit v1.2.3-70-g09d2