diff options
Diffstat (limited to '')
| -rw-r--r-- | webmentions_ssg/tasks/discovery.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/webmentions_ssg/tasks/discovery.py b/webmentions_ssg/tasks/discovery.py index 107d30a..becac58 100644 --- a/webmentions_ssg/tasks/discovery.py +++ b/webmentions_ssg/tasks/discovery.py @@ -14,6 +14,7 @@ from flask import current_app from ..net import ( ResponseTooLargeError, + content_type_of, is_http_url, is_temporary_status, read_limited_body, @@ -173,9 +174,7 @@ def discover_webmention_endpoint(client: httpx.Client, target: str) -> str | Non if not response.is_success: raise PermanentSenderError(f"Target returned HTTP {response.status_code}") - media_type = ( - response.headers.get("Content-Type", "").partition(";")[0].strip().lower() - ) + media_type = content_type_of(response.headers) if media_type not in {"text/html", "application/xhtml+xml"}: return None |
