Module: VCR::LibraryHooks::Typhoeus
- Defined in:
- lib/vcr/library_hooks/typhoeus.rb,
lib/vcr/library_hooks/typhoeus_0.4.rb
Defined Under Namespace
Classes: RequestHandler
Class Method Summary collapse
- .collect_chunks(request) ⇒ Object
- .restore_body_from_chunks(response, request) ⇒ Object
- .vcr_response_from(response) ⇒ Object
Class Method Details
.collect_chunks(request) ⇒ Object
94 95 96 97 98 99 100 101 102 |
# File 'lib/vcr/library_hooks/typhoeus.rb', line 94 def collect_chunks(request) chunks = '' request.on_body.unshift( Proc.new do |body, response| chunks += body request.instance_variable_set(:@chunked_body, chunks) end ) end |
.restore_body_from_chunks(response, request) ⇒ Object
104 105 106 |
# File 'lib/vcr/library_hooks/typhoeus.rb', line 104 def restore_body_from_chunks(response, request) response.[:response_body] = request.instance_variable_get(:@chunked_body) end |
.vcr_response_from(response) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/vcr/library_hooks/typhoeus_0.4.rb', line 57 def vcr_response_from(response) VCR::Response.new \ VCR::ResponseStatus.new(response.code, response.), response.headers, response.body, response.http_version, { "effective_url" => response.effective_url } end |