Sha256: 3bb85e0ab699955f716e7a05168810de59013d926b9db23e187b6210e826cb06
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 Bytes
Contents
# -*- encoding : utf-8 -*- module Pacto class Consumer class FaradayDriver # Sends a Pacto::PactoRequest def execute(req) conn = Faraday.new(url: req.uri.site) do |faraday| faraday.response :logger if Pacto.configuration.logger.level == :debug faraday.adapter Faraday.default_adapter end response = conn.send(req.method) do |faraday_request| faraday_request.url(req.uri.path, req.uri.query_values) faraday_request.headers = req.headers faraday_request.body = req.body end faraday_to_pacto_response response end private # This belongs in an adapter def faraday_to_pacto_response(faraday_response) data = { status: faraday_response.status, headers: faraday_response.headers, body: faraday_response.body } Pacto::PactoResponse.new(data) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pacto-0.4.0.rc1 | lib/pacto/consumer/faraday_driver.rb |