request: Use Django 5.2 HttpRequest.get_preferred_type.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2025-06-10 10:48:35 -07:00
committed by Tim Abbott
parent 6006ba4c44
commit d24eab02d2
4 changed files with 10 additions and 57 deletions

View File

@@ -16,7 +16,6 @@ from corporate.lib.remote_billing_util import (
get_remote_server_and_user_from_session,
)
from zerver.lib.exceptions import RemoteBillingAuthenticationError
from zerver.lib.request import get_preferred_type
from zerver.lib.subdomains import get_subdomain
from zerver.lib.url_encoding import append_url_query_string
from zilencer.models import RemoteRealm
@@ -125,7 +124,7 @@ def authenticated_remote_realm_management_endpoint(
# Return error for AJAX requests with url.
if (
get_preferred_type(request, ["application/json", "text/html"]) != "text/html"
request.get_preferred_type(["application/json", "text/html"]) != "text/html"
): # nocoverage
return session_expired_ajax_response(url)
@@ -211,7 +210,7 @@ def authenticated_remote_server_management_endpoint(
# Return error for AJAX requests with url.
if (
get_preferred_type(request, ["application/json", "text/html"]) != "text/html"
request.get_preferred_type(["application/json", "text/html"]) != "text/html"
): # nocoverage
return session_expired_ajax_response(url)