From 8285aa7405fa538ef74ed373929571c513ebcc2f Mon Sep 17 00:00:00 2001 From: Robin5605 Date: Sat, 12 Aug 2023 19:59:50 -0500 Subject: [PATCH] Remove trailing slash in get commit hash endpoint --- src/mainframe/rules.py | 2 +- tests/test_rules.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mainframe/rules.py b/src/mainframe/rules.py index ea60c8b7..cb1e9272 100644 --- a/src/mainframe/rules.py +++ b/src/mainframe/rules.py @@ -23,7 +23,7 @@ def build_auth_header(access_token: str) -> dict[str, str]: def fetch_commit_hash(http_session: Session, *, repository: str, access_token: str) -> str: """Fetch the top commit hash of the given repository""" - url = f"https://api.github.com/repos/{repository}/commits/main/" + url = f"https://api.github.com/repos/{repository}/commits/main" authentication_headers = build_auth_header(access_token) json_headers = {"Accept": "application/vnd.github.VERSION.sha"} headers = authentication_headers | json_headers diff --git a/tests/test_rules.py b/tests/test_rules.py index 239b8beb..2c7fa369 100644 --- a/tests/test_rules.py +++ b/tests/test_rules.py @@ -24,7 +24,7 @@ def test_build_auth_header(): def test_fetch_commit_hash(): mock_session: Any = Mock() - url = "https://api.github.com/repos/owner-name/repo-name/commits/main/" + url = "https://api.github.com/repos/owner-name/repo-name/commits/main" headers = { "Authorization": "Bearer token", "Accept": "application/vnd.github.VERSION.sha",