What does WARN Could not determine content-length of response body. mean and how to I get rid of it?
Asked the same question to one of Rails-Core's members:
https://twitter.com/luislavena/status/108998968859566080
And the answer:
https://twitter.com/tenderlove/status/108999110136303617
ya, it's fine. Need to clean it up, but nothing is being hurt.
WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
This is a problem of Webrick.
you can use "Thin" instead.
Add this to Gemfile
gem 'thin'
then rails s
will use thin instead of Webrick, and the warn will disappear.
WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
This is a problem of Webrick.
you can use "Thin" instead.
Add this to Gemfile
gem 'thin'
then rails s
will use thin instead of Webrick, and the warn will disappear.
Mechanize::ResponseReadError - Content-Length does not match response body length
It happens that sites return a wrong content length-value. Catch the error and force page parsing.
agent = Mechanize.new
begin
page = agent.get 'http://bad.com'
rescue Mechanize::ResponseReadError => e
page = e.force_parse
end
You can also set agent.ignore_bad_chunking
to true — but then beware of possible silent content loss.
Ruby on Rails warn
As i understood correctly its nothing to worry about it gets removed by the Rails-Core's members.
As Jipiboily already said:
Duplicate
of:http://stackoverflow.com/questions/7082364/what-does-warn-could-not-determine-content-length-of-response-body-mean-and-h
cheers
stub_request must return array in body
Try this at the end of your call:
.to_return(status: 200, body: '{"invoices" => [{ "invoice_id": "123"}]}', headers: {})
Warning in rails server - localhost
The server and the console operate independently, as separate applications. So if you fire up a console with rails c
, it will be a standalone build of your application. Similarly, if you do rails s
, it will also be standalone.
The exception is that they both share your development database, so if you make changes to the database with the console, they will be reflected on a page refresh of your server. Vice versa is also true.
Don't worry about the warnings for content length on the server, they don't affect anything.
EDIT
For debugging purposes, you can write custom items to the log, or you can display items such as params, etc in the view layer. More info on that here: http://guides.rubyonrails.org/debugging_rails_applications.html
Related Topics
Best Way to Convert Strings to Symbols in Hash
Rails 4: Before_Filter Vs. Before_Action
Is There a Performance Gain in Using Single Quotes VS Double Quotes in Ruby
Is It Good Style to Explicitly Return in Ruby
Rails: Activerecord Query Based on Association Value
What's the Difference Between a String and a Symbol in Ruby
Access Variables Programmatically by Name in Ruby
&:Views_Count' in 'Post.Published.Collect(&:Views_Count)'
When Should I Use Struct Vs. Openstruct
Ruby/Ruby on Rails Memory Leak Detection
Why Isn't the Eigenclass Equivalent to Self.Class, When It Looks So Similar
How to Parse a Yaml File in Ruby
Is the Ruby Operator ||= Intelligent
Pg::Error: Select Distinct, Order by Expressions Must Appear in Select List