Skip to content

Only set Authorization when token is available - #3789

Merged
gmlewis merged 1 commit into
google:masterfrom
jsoref:only-set-auth-when-token-available
Oct 23, 2025
Merged

Only set Authorization when token is available#3789
gmlewis merged 1 commit into
google:masterfrom
jsoref:only-set-auth-when-token-available

Conversation

@jsoref

@jsorefjsoref commented Oct 23, 2025

Copy link
Copy Markdown
Contributor

Fixes: #3788

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.
Merging.

@codecov

codecovBot commented Oct 23, 2025

Copy link
Copy Markdown

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.

@gmlewis
gmlewis merged commit b755d64 into google:masterOct 23, 2025
7 checks passed
@jsoref
jsoref deleted the only-set-auth-when-token-available branch October 23, 2025 23:50
@jsorefjsoref mentioned this pull request Oct 24, 2025
Comment threadgithub/github.go
Comment on lines +357 to +359
if token != "" {
req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token))
}

Copy link
Copy Markdown
Contributor

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

jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authorization field should not be sent with an empty bearer token because it yields an error

3 participants

@jsoref@alexandear@gmlewis