Skip to content

Commit

Permalink
fix don't remove headers only use them
Browse files Browse the repository at this point in the history
  • Loading branch information
jazavala committed Dec 3, 2020
1 parent 5966cfc commit 1cbd72b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/api_auth/client/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def build_request(mtd, path, payload)
url: endpoint_uri(path),
ssl_version: 'SSLv23',
headers: json_headers,
}.merge(args)
}.merge(args&.except(:headers)&.to_h)

params[:payload] = payload.to_json if payload.present?
params.merge!(user: app_id, password: secret_key) if type == :basic
Expand All @@ -70,7 +70,7 @@ def json_headers
accept: :json,
}
headers.merge!(authorization: "Bearer #{auth_token}") if type == :token
headers.merge!(args.delete(:headers)) if args.key?(:headers)
headers.merge!(args[:headers]) if args.key?(:headers)
headers
end

Expand Down

0 comments on commit 1cbd72b

Please sign in to comment.