本文介绍了WARN 无法确定响应正文的内容长度.设置响应的内容长度或设置 Response#chunked = true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能的重复:
什么是"WARN 无法确定响应正文的内容长度."意思是我如何摆脱它?
我刚刚升级到 rails 3.2.2,现在在 rails s,页面加载时,我在日志中收到所有这些错误:
I just upgraded to rails 3.2.2, and now on rails s, page load, I get all these errors in the log:
[2012-03-07 19:46:14] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2012-03-07 19:46:14] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
根据之前的 SO 线程,我尝试了以下操作:
Per previous SO threads, I tried the following:
/config/application.rb
config.assets.logger = false
config.assets.logger = nil
这些都没有用.关于如何为此错误禁用此日志记录的任何想法?或者解决这个问题:)
None of these worked. Any ideas on how to disable this logging for this error? Or to fix the issue :)
谢谢
推荐答案
这是 Webrick 的问题.您可以改用瘦".
This is a problem of Webrick.you can use "Thin" instead.
将此添加到 Gemfile
Add this to Gemfile
gem 'thin'
然后 rails s
将使用 Thin 而不是 Webrick,并且警告将消失.
then rails s
will use thin instead of Webrick, and the warn will disappear.
这篇关于WARN 无法确定响应正文的内容长度.设置响应的内容长度或设置 Response#chunked = true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!