Skip to content
Snippets Groups Projects
Commit d7481af6 authored by vlorentz's avatar vlorentz
Browse files

Fix typing issue

response.content_type is set by Dulwich, but isn't part of urllib3's
HTTPResponse, so we shouldn't rely on it.
(And it makes mypy complain when the 'types-urllib3' package is installed)
parent 0cc96c25
No related branches found
No related tags found
No related merge requests found
......@@ -55,11 +55,11 @@ def check_protocol(repo_url: str) -> bool:
http_client = DumbHttpGitClient(repo_url)
url = http_client.get_url("info/refs?service=git-upload-pack")
response = http_client.get(url)
content_type = response.getheader("Content-Type")
return (
response.status in (200, 304,)
# header is not mandatory in protocol specification
and response.content_type is None
or not response.content_type.startswith("application/x-git-")
and (content_type is None or not content_type.startswith("application/x-git-"))
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment