1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #7109: Ensure human readability of exceptions raised during REST API requests

This commit is contained in:
jeremystretch
2021-09-01 10:43:12 -04:00
parent f63dcb1f08
commit d2fe59ae8f
3 changed files with 7 additions and 5 deletions

View File

@ -48,7 +48,8 @@ def is_api_request(request):
Return True of the request is being made via the REST API.
"""
api_path = reverse('api-root')
return request.path_info.startswith(api_path)
return request.path_info.startswith(api_path) and request.content_type == 'application/json'
def get_view_name(view, suffix=None):