mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-28 10:16:10 -06:00
Fixes #20001: is_api_request() should not evaluate a request's content type
This commit is contained in:
parent
de53fd2bd1
commit
d4b30a64ba
@ -9,7 +9,6 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from rest_framework.serializers import Serializer
|
from rest_framework.serializers import Serializer
|
||||||
from rest_framework.views import get_view_name as drf_get_view_name
|
from rest_framework.views import get_view_name as drf_get_view_name
|
||||||
|
|
||||||
from extras.constants import HTTP_CONTENT_TYPE_JSON
|
|
||||||
from netbox.api.exceptions import GraphQLTypeNotFound, SerializerNotFound
|
from netbox.api.exceptions import GraphQLTypeNotFound, SerializerNotFound
|
||||||
from netbox.api.fields import RelatedObjectCountField
|
from netbox.api.fields import RelatedObjectCountField
|
||||||
from .query import count_related, dict_to_filter_params
|
from .query import count_related, dict_to_filter_params
|
||||||
@ -56,8 +55,7 @@ def is_api_request(request):
|
|||||||
"""
|
"""
|
||||||
Return True of the request is being made via the REST API.
|
Return True of the request is being made via the REST API.
|
||||||
"""
|
"""
|
||||||
api_path = reverse('api-root')
|
return request.path_info.startswith(reverse('api-root'))
|
||||||
return request.path_info.startswith(api_path) and request.content_type == HTTP_CONTENT_TYPE_JSON
|
|
||||||
|
|
||||||
|
|
||||||
def get_view_name(view):
|
def get_view_name(view):
|
||||||
|
Loading…
Reference in New Issue
Block a user