Skip to content

Improve handling when DJDT views don't respond with JSON #1847

Closed
@TreyWW

Description

@TreyWW

Sidebar loads fine until you press any of the buttons, for example "Cache".

As soon as i press it i get
image

VM14865:2 Uncaught (in promise) SyntaxError: Unexpected token '<', "
<html>

<h"... is not valid JSON

I load django toolbar at the start so

urlpatterns = [

]
if settings.DEBUG:
    import debug_toolbar

    urlpatterns += [
        url("__debug__/", include(debug_toolbar.urls)),
    ]

urlpatterns += [] # my normal urls

Also does it after my normal urls. Does it in all of my projects now, not sure why but it's really annoying. One of my other test pages calls a request every 7 seconds, and each time it fetches data i get that error on my screen. So annoying.

I'm happy to provide more details

Thanks :)


Edit from Tim:

This issue is because the toolbar views have some authorization logic wrapping them causing the responses to be HTML rather than JSON. Our JS frontend should identify when the responses don't match expectations and notify the user of such to make it easier to diagnose.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions