D
David Madden
Hi,
I am playing arround with Net::HTTP and have this little script to
grap a websites HTML:
require "net/http"
page = "http://www.google.co.uk"
response = Net::HTTP.get_response(URI.parse(page))
puts response.body if response.body_permitted?
I aim to print out the body of the response object only if it is
permitted but I get this:
NoMethodError: undefined method `body_permitted?' for #<Net::HTTPOK
200 OK readbody=true>
So I am not sure what is going on as get_response returns an
HTTPResponce object so calling body_permitted?' on it should work.
Any ideas?
David.
I am playing arround with Net::HTTP and have this little script to
grap a websites HTML:
require "net/http"
page = "http://www.google.co.uk"
response = Net::HTTP.get_response(URI.parse(page))
puts response.body if response.body_permitted?
I aim to print out the body of the response object only if it is
permitted but I get this:
NoMethodError: undefined method `body_permitted?' for #<Net::HTTPOK
200 OK readbody=true>
So I am not sure what is going on as get_response returns an
HTTPResponce object so calling body_permitted?' on it should work.
Any ideas?
David.