slimmer 1.1.22 → 1.1.23

Sign up to get free protection for your applications and to get access to all the features.
data/lib/slimmer/app.rb CHANGED
@@ -92,6 +92,9 @@ module Slimmer
92
92
  rewritten_body = app_body
93
93
  end
94
94
  rewritten_body = [rewritten_body] unless rewritten_body.respond_to?(:each)
95
+
96
+ headers['Content-Length'] = rewritten_body.join("").bytesize.to_s
97
+
95
98
  logger.debug "Slimmer: Returning final status, headers and body"
96
99
  [status, headers, rewritten_body]
97
100
  end
@@ -1,3 +1,3 @@
1
1
  module Slimmer
2
- VERSION = '1.1.22'
2
+ VERSION = '1.1.23'
3
3
  end
@@ -11,6 +11,28 @@ module TypicalUsage
11
11
  end
12
12
  end
13
13
 
14
+ class ContentLengthTest < SlimmerIntegrationTest
15
+ given_response 200, %{
16
+ <html>
17
+ <head><title>The title of the page</title>
18
+ <meta name="something" content="yes">
19
+ <meta name="x-section-name" content="This section">
20
+ <meta name="x-section-link" content="/this_section">
21
+ <script src="blah.js"></script>
22
+ <link href="app.css" rel="stylesheet" type="text/css">
23
+ </head>
24
+ <body class="body_class">
25
+ <div id="wrapper">The body of the page</div>
26
+ </body>
27
+ </html>
28
+ }
29
+
30
+ def test_should_set_correct_content_length_header
31
+ assert_equal "791", last_response.headers['Content-Length']
32
+ end
33
+
34
+ end
35
+
14
36
  class NormalResponseTest < SlimmerIntegrationTest
15
37
  given_response 200, %{
16
38
  <html>
@@ -220,4 +242,4 @@ module TypicalUsage
220
242
  assert_rendered_in_template "head title", "406 Not Acceptable"
221
243
  end
222
244
  end
223
- end
245
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: slimmer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.22
5
+ version: 1.1.23
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ben Griffiths
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2012-01-19 00:00:00 Z
14
+ date: 2012-01-20 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: nokogiri
@@ -193,7 +193,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
193
  requirements:
194
194
  - - ">="
195
195
  - !ruby/object:Gem::Version
196
- hash: -3534420028075206632
196
+ hash: -1363822644242049951
197
197
  segments:
198
198
  - 0
199
199
  version: "0"
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  requirements:
203
203
  - - ">="
204
204
  - !ruby/object:Gem::Version
205
- hash: -3534420028075206632
205
+ hash: -1363822644242049951
206
206
  segments:
207
207
  - 0
208
208
  version: "0"