|
25 | 25 | # pylint: disable=unused-argument |
26 | 26 |
|
27 | 27 | import json |
| 28 | +from json import JSONDecodeError |
28 | 29 |
|
29 | 30 | from django.http import HttpResponse, HttpResponseRedirect |
30 | 31 | from django.shortcuts import redirect |
@@ -79,7 +80,10 @@ def _update(request, ident, stateless=False, **kwargs): |
79 | 80 | 'Generate update json response' |
80 | 81 | dash_app, app = DashApp.locate_item(ident, stateless) |
81 | 82 |
|
82 | | - request_body = json.loads(request.body.decode('utf-8')) |
| 83 | + try: |
| 84 | + request_body = json.loads(request.body.decode('utf-8')) |
| 85 | + except (JSONDecodeError, UnicodeDecodeError): |
| 86 | + return HttpResponse(status=200) |
83 | 87 |
|
84 | 88 | # Use direct dispatch with extra arguments in the argMap |
85 | 89 | app_state = request.session.get("django_plotly_dash", dict()) |
|
0 commit comments