# File lib/webmock/http_lib_adapters/net_http_response.rb, line 17
17: def self.extended(object)
18: body_object = object.instance_variable_get(:@body)
19: object.instance_variable_set(:@__orig_body__,
20: case body_object
21: when String then body_object
22: when nil then nil
23: else raise ArgumentError.new("Unexpected body object: #{body_object}")
24: end
25: )
26: end
# File lib/webmock/http_lib_adapters/net_http_response.rb, line 28
28: def read_body(dest = nil, &block)
29: if @__orig_body__
30: if dest && block
31: raise ArgumentError.new("both arg and block given for HTTP method")
32: elsif dest
33: dest << @__orig_body__
34: elsif block
35: @body = ::Net::ReadAdapter.new(block)
36: @body << @__orig_body__
37: @body
38: else
39: @body = @__orig_body__
40: end
41: else
42: super
43: end
44: ensure
45: # allow subsequent calls to #read_body to proceed as normal, without our hack...
46: @__orig_body__ = nil
47: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.