Skip to content
Browse files

Merge pull request #93 from mikedouglas/master

Correctly set Content-Length when using Ruby 1.9
  • Loading branch information...
2 parents c8622d5 + 3c3217b commit 7af9a057ad422c591ff2b70fbd425d50dffb0ebc Alexis Sellier committed
Showing with 7 additions and 1 deletion.
  1. +6 −0 lib/ext/ext.rb
  2. +1 −1 lib/toto.rb
View
6 lib/ext/ext.rb
@@ -14,6 +14,12 @@ def slugize
def humanize
self.capitalize.gsub(/[-_]+/, ' ')
end
+
+ if RUBY_VERSION < "1.9"
+ def bytesize
+ size
+ end
+ end
end
class Fixnum
View
2 lib/toto.rb
@@ -338,7 +338,7 @@ def call env
response = @site.go(route, env, *(mime ? mime : []))
@response.body = [response[:body]]
- @response['Content-Length'] = response[:body].length.to_s unless response[:body].empty?
+ @response['Content-Length'] = response[:body].bytesize.to_s unless response[:body].empty?
@response['Content-Type'] = Rack::Mime.mime_type(".#{response[:type]}")
# Set http cache headers

0 comments on commit 7af9a05

Please sign in to comment.
Something went wrong with that request. Please try again.