Hi,
I tried to setup body for Net::HTTPResponse in my test code.
But I can’t achieve that without weird patch.
I try the same on ruby 1.9.3 and 1.8.7 but behavior is the same.
require ‘net/http.rb’
response = Net::HTTPResponse.new(‘1.0’, “200”, “OK”)
response.body = “test”
p response.body # => nil
working example
require ‘net/http.rb’
response = Net::HTTPResponse.new(‘1.0’, “200”, “OK”)
response.body
response.body = “test”
p response.body # => test
Why I need first use response.body to make it work?
What I do wrong here?
Is there any easier way to create response with body?
Thanks a lot
Robert M.