Sha256: 17e741220fedf178cef552e4662ac7a824e6e49f67d18a5cdd688aac5b7a10df
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
require 'faraday_middleware' require 'faraday/response/raise_octokit_error' module Octokit # @private module Connection private def connection(options={}) options = { :authenticate => true, :force_urlencoded => false, :raw => false }.merge(options) if !proxy.nil? options.merge!(:proxy => proxy) end if !oauthed? && !authenticated? && unauthed_rate_limited? options.merge!(:params => unauthed_rate_limit_params) end # TODO: Don't build on every request connection = Faraday.new(options) do |builder| if options[:force_urlencoded] builder.request :url_encoded else builder.request :json end builder.use Faraday::Response::RaiseOctokitError builder.use FaradayMiddleware::FollowRedirects builder.use FaradayMiddleware::Mashify builder.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/ faraday_config_block.call(builder) if faraday_config_block builder.adapter *adapter end if options[:authenticate] and authenticated? connection.basic_auth authentication[:login], authentication[:password] end connection.headers[:user_agent] = user_agent connection end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
octokit-1.25.0 | lib/octokit/connection.rb |
octokit-1.24.0 | lib/octokit/connection.rb |