lib/dato/api_client.rb in dato-0.6.5 vs lib/dato/api_client.rb in dato-0.6.6
- old
+ new
@@ -73,18 +73,20 @@
end
private
def connection
+ default_headers = {
+ 'Accept' => 'application/json',
+ 'Content-Type' => 'application/json',
+ 'Authorization' => "Bearer #{@token}",
+ 'User-Agent' => "ruby-client v#{Dato::VERSION}",
+ 'X-Api-Version' => "2"
+ }
+
options = {
url: base_url,
- headers: extra_headers.merge(
- 'Accept' => 'application/json',
- 'Content-Type' => 'application/json',
- 'Authorization' => "Bearer #{@token}",
- 'User-Agent' => "ruby-client v#{Dato::VERSION}",
- 'X-Api-Version' => "2"
- )
+ headers: default_headers.merge(extra_headers)
}
@connection ||= Faraday.new(options) do |c|
c.request :json
c.response :json, content_type: /\bjson$/