A Net::HTTP response that has already been read raises an IOError when read_body is called with a destination string or block.
This causes a problem when VCR records a response—it reads the body before yielding the response, and if the code that is consuming the HTTP requests uses read_body, it can cause an error.
This is a bit of a hack, but it allows a Net::HTTP response to be "re-read" after it has aleady been read. This attemps to preserve the behavior of read_body, acting just as if it had never been read.
LOCALHOST_ALIASES | = | %w( localhost 127.0.0.1 0.0.0.0 ) | ||
YAML | = | begin require 'psych' | Attempt to use psych if it is available. | |
Ping | = | ::Ping | ||
BasicObject | = | ::BasicObject |