EOFError (end of file reached) in Ruby on Rails with http.request
get, http, ruby, ruby-on-rails
Solution
I think it is a some sort of bug; `typhoeus` seems to work:
require 'typhoeus'
response = Typhoeus.get("http://84.38.185.251:9262/send")
p response.body
#=> {"ids":"-1","data":{"temp":"nan","h":"-1"},"status":"255","voltage":"-1"}
Problem
I am trying to get json form url : ``` uri = URI.parse("http://84.38.185.251:9262/send") http = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) response.code # => 301 response.body # => The body (HTML, XML, blob, whatever) response["cache-control"] # => public, max-age=2592000 puts response.body ``` but i get an error :`EOFError (end of file reached): app/controllers/sensors_controller.rb:35:in sensinfo' sensors_controller.rb:35: ``` response = http.request(request) ``` What am i did wrong?