lib/github_api/connection.rb in github_api-0.12.2 vs lib/github_api/connection.rb in github_api-0.12.3
- old
+ new
@@ -24,11 +24,16 @@
ACCEPT_CHARSET => 'utf-8',
USER_AGENT => options[:user_agent]
},
ssl: options[:ssl],
url: options[:endpoint]
- }
+ }.tap do |h|
+ if type = options[:headers] && options[:headers][CONTENT_TYPE]
+ h[:headers][CONTENT_TYPE] = type
+ end
+ h
+ end
end
def clear_cache
@connection = nil
end
@@ -54,9 +59,10 @@
def connection(api, options = {})
connection_options = default_options(options)
clear_cache unless options.empty?
builder = api.stack ? api.stack : stack(options.merge!(api: api))
connection_options.merge!(builder: builder)
+ connection_options.deep_merge!(options[:connection_options]) if options[:connection_options]
if ENV['DEBUG']
p "Connection options : \n"
pp connection_options
end
@connection ||= Faraday.new(connection_options)