Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
Headers precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoverna committed Jul 20, 2018
1 parent 68874b0 commit ccbff4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions lib/dato/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ def request(*args)
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|
Expand Down
2 changes: 1 addition & 1 deletion lib/dato/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
module Dato
VERSION = '0.6.5'
VERSION = '0.6.6'
end

0 comments on commit ccbff4d

Please sign in to comment.