Sha256: f7573d7067de034576db72f68e30df7449c0c4855dba268c185d584710b2b4ec
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
require 'typhoeus' module Acfs module Adapter # Adapter for Typhoeus. # class Typhoeus < Base def start hydra.run rescue @hydra = nil raise end def abort hydra.abort end def run(request) convert_request(request).run end def queue(request) hydra.queue convert_request request end protected def hydra @hydra ||= ::Typhoeus::Hydra.new end def convert_request(req) request = ::Typhoeus::Request.new req.url, method: req.method, params: req.params, headers: req.headers.merge( 'Expect' => '', 'Transfer-Encoding' => '' ), body: req.body request.on_complete do |response| req.complete! convert_response(req, response) end request end def convert_response(request, response) Acfs::Response.new request, status: response.code, headers: response.headers, body: response.body end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
acfs-0.42.0 | lib/acfs/adapter/typhoeus.rb |
acfs-0.41.1 | lib/acfs/adapter/typhoeus.rb |
acfs-0.41.1.beta1 | lib/acfs/adapter/typhoeus.rb |