Use Rack::Utils.bytesize; pin to rack >= 1.0
This commit is contained in:
parent
428a1ec51d
commit
9de67b15c6
|
@ -43,7 +43,7 @@ module Sinatra
|
||||||
body = [body] if body.respond_to? :to_str
|
body = [body] if body.respond_to? :to_str
|
||||||
if body.respond_to?(:to_ary)
|
if body.respond_to?(:to_ary)
|
||||||
header["Content-Length"] = body.to_ary.
|
header["Content-Length"] = body.to_ary.
|
||||||
inject(0) { |len, part| len + part.bytesize }.to_s
|
inject(0) { |len, part| len + Rack::Utils.bytesize(part) }.to_s
|
||||||
end
|
end
|
||||||
[status.to_i, header.to_hash, body]
|
[status.to_i, header.to_hash, body]
|
||||||
end
|
end
|
||||||
|
@ -1106,13 +1106,3 @@ module Sinatra
|
||||||
Default.helpers(*extensions, &block)
|
Default.helpers(*extensions, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class String #:nodoc:
|
|
||||||
# Define String#each under 1.9 for Rack compatibility. This should be
|
|
||||||
# removed once Rack is fully 1.9 compatible.
|
|
||||||
alias_method :each, :each_line unless ''.respond_to? :each
|
|
||||||
|
|
||||||
# Define String#bytesize as an alias to String#length for Ruby 1.8.6 and
|
|
||||||
# earlier.
|
|
||||||
alias_method :bytesize, :length unless ''.respond_to? :bytesize
|
|
||||||
end
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ Gem::Specification.new do |s|
|
||||||
s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/}
|
s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/}
|
||||||
|
|
||||||
s.extra_rdoc_files = %w[README.rdoc LICENSE]
|
s.extra_rdoc_files = %w[README.rdoc LICENSE]
|
||||||
s.add_dependency 'rack', '>= 0.9.1'
|
s.add_dependency 'rack', '>= 1.0'
|
||||||
s.add_development_dependency 'shotgun', '>= 0.2', '< 1.0'
|
s.add_development_dependency 'shotgun', '>= 0.2', '< 1.0'
|
||||||
s.add_development_dependency 'rack-test', '>= 0.3.0'
|
s.add_development_dependency 'rack-test', '>= 0.3.0'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue