Skip to content

Commit 272dfea

Browse files
committed
Use recommended form for "Authorization" header in GitHub API requests
The previous "token" format works fine, but the "Bearer" format is the one used in the snippets in the GitHub REST API documentation so this format makes the code easier to understand.
1 parent 52c3d5f commit 272dfea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

reportsizedeltas/reportsizedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ def raw_http_request(self, url: str, data: bytes | None = None):
627627

628628
headers = {
629629
"Accept": "application/vnd.github+json",
630-
"Authorization": "token " + self.token,
630+
"Authorization": "Bearer " + self.token,
631631
# GitHub recommends using user name as User-Agent (https://developer.github.com/v3/#user-agent-required)
632632
"User-Agent": self.repository_name.split("/")[0],
633633
}

reportsizedeltas/tests/test_reportsizedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ def test_raw_http_request(mocker):
891891
url=url,
892892
headers={
893893
"Accept": "application/vnd.github+json",
894-
"Authorization": "token " + token,
894+
"Authorization": "Bearer " + token,
895895
"User-Agent": user_name,
896896
},
897897
data=data,

0 commit comments

Comments
 (0)