diff options
| author | Stormwind <stormwind@stormwinds-page.de> | 2012-11-24 16:17:14 +0100 | 
|---|---|---|
| committer | Stormwind <stormwind@stormwinds-page.de> | 2012-11-24 16:17:14 +0100 | 
| commit | 7213e3e8f6cf1237ce86a80e26391e98656766a1 (patch) | |
| tree | 0b75d105493f196396f7ab41b5f0f8b43ed227c4 | |
| parent | 13eae5cfa5efd6af6e47ea03a58fbb79399a3308 (diff) | |
Content-Length must be a String
| -rw-r--r-- | lib/zero/response.rb | 2 | ||||
| -rw-r--r-- | spec/unit/response/response_spec.rb | 14 | 
2 files changed, 8 insertions, 8 deletions
| diff --git a/lib/zero/response.rb b/lib/zero/response.rb index 373a65b..24c1aaf 100644 --- a/lib/zero/response.rb +++ b/lib/zero/response.rb @@ -55,7 +55,7 @@ module Zero      # Also creates one, if it does not exists      #      def content_length -      self.header['Content-Length'] = body.join.bytesize +      self.header['Content-Length'] = body.join.bytesize.to_s      end      # Sets the content type header to the given value diff --git a/spec/unit/response/response_spec.rb b/spec/unit/response/response_spec.rb index 59358c0..9d2097a 100644 --- a/spec/unit/response/response_spec.rb +++ b/spec/unit/response/response_spec.rb @@ -22,15 +22,15 @@ describe Zero::Response do        subject.body = ['foobar']        value = subject.to_a -      value[1]['Content-Length'].should eq(6)  # Headers +      value[1]['Content-Length'].should eq('6')  # Headers      end      it "does not fix the Content-Length, if it's already set" do        subject.body = ['foobar'] -      subject.header = {'Content-Length' => 3} +      subject.header = {'Content-Length' => '3'}        value = subject.to_a -      value[1]['Content-Length'].should eq(3)  # Headers +      value[1]['Content-Length'].should eq('3')  # Headers      end      it "returns the Content-Type in the header" do @@ -96,24 +96,24 @@ describe Zero::Response do    end    describe '#content_length' do -    it "sets the Content-Length to 0, if there is no content" do +    it "sets the Content-Length to '0', if there is no content" do        subject.content_length -      subject.header['Content-Length'].should eq(0) +      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) +      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) +      subject.header['Content-Length'].should eq('9')      end    end | 
