misc: use application/javascript for menu.json served as jsonp (#14685)
This commit is contained in:
parent
81e955d803
commit
57765a7916
|
@ -133,15 +133,17 @@ def health_json(request):
|
|||
|
||||
@admin_required
|
||||
def menu_json(request):
|
||||
response = HttpResponse(content_type='application/json')
|
||||
label = _('System')
|
||||
json_str = json.dumps([{'label': force_text(label),
|
||||
'slug': 'system',
|
||||
'url': request.build_absolute_uri(reverse('home'))
|
||||
}])
|
||||
content_type = 'application/json'
|
||||
for variable in ('jsonpCallback', 'callback'):
|
||||
if variable in request.GET:
|
||||
json_str = '%s(%s);' % (request.GET[variable], json_str)
|
||||
content_type = 'application/javascript'
|
||||
break
|
||||
response = HttpResponse(content_type=content_type)
|
||||
response.write(json_str)
|
||||
return response
|
||||
|
|
Loading…
Reference in New Issue