ruby - unable to get content-length header working under rails 4.1+puma -
ruby - unable to get content-length header working under rails 4.1+puma -
setup is: puma: 2.9.1 rails: 4.1.5 rack: 1.5.2
as per documentation tried contentlength header working adding fallowing application.rb
config.middleware.use rack::contentlength
unfortunately response still chunked. after investingation found next status in rack::contentlength class:
if !status_with_no_entity_body.include?(status.to_i) && !headers['content-length'] && !headers['transfer-encoding'] && body.respond_to?(:to_ary)
body.respond_to?(:to_ary) 1 yields false. @ context body instance of rack::bodyproxy in responds_to? overriden:
def respond_to?(*args) homecoming false if args.first.to_s =~ /^to_ary$/ super or @body.respond_to?(*args) end
i confused here. removing body.respond_to?(:to_ary) resolves issue, dont sense safe removing chunks of code rack lib. help getting content-length header working appreciated. thanks.
ruby-on-rails ruby rack content-length puma
Comments
Post a Comment