this needs to return the body

With to_s this is returning something like '#<Net::HTTPOK:0x007fbd31708f28>' instead of the cert and the connection fails when using the 'New window' button.