Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Faraday deprecation warning #36

Merged
merged 2 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

## TBD

* Fix Faraday deprecation warning
| [sambostock](https://github.com/sambostock)
| [#36](https://github.com/bugsnag/bugsnag-api-ruby/pull/36)

## 2.1.0 (28 July 2021)

### Enhancements
Expand Down
8 changes: 6 additions & 2 deletions lib/bugsnag/api/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
require "bugsnag/api/client/stability"
require "bugsnag/api/client/releases"

require "base64"

module Bugsnag
module Api

Expand Down Expand Up @@ -169,9 +171,11 @@ def agent
http.headers[:user_agent] = configuration.user_agent

if basic_authenticated?
http.basic_auth configuration.email, configuration.password
credentials = Base64.strict_encode64("#{configuration.email}:#{configuration.password}")

http.headers[:Authorization] = "Basic #{credentials}"
elsif token_authenticated?
http.authorization "token", configuration.auth_token
http.headers[:Authorization] = "token #{configuration.auth_token}"
end
end
end
Expand Down