Only set `Authorization` when `token` is available by jsoref · Pull Request #3789 · google/go-github

@jsoref

@jsoref

gmlewis

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Merging.

@codecov

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.14%. Comparing base (98a62fd) to head (cdc8ba1).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3789      +/-   ##
==========================================
+ Coverage   91.50%   92.14%   +0.63%     
==========================================
  Files         190      190              
  Lines       17007    13627    -3380     
==========================================
- Hits        15562    12556    -3006     
+ Misses       1257      883     -374     
  Partials      188      188              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jsoref jsoref deleted the only-set-auth-when-token-available branch

October 23, 2025 23:50

alexandear

Comment on lines +357 to +359

if token != "" {
req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token))
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a test for this #3790