allow cross origin content-type header

This commit is contained in:
j 2018-01-12 11:35:37 +01:00
parent b6dcccb230
commit f44584f131
1 changed files with 2 additions and 0 deletions

View File

@ -17,6 +17,8 @@ def api(request):
response = render_to_json_response({'status': {'code': 200,
'text': 'use POST'}})
response['Access-Control-Allow-Origin'] = '*'
response['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
response['Access-Control-Allow-Headers'] = 'Content-Type'
return response
if request.META['REQUEST_METHOD'] != "POST" or (
not 'action' in request.POST and request.META.get('CONTENT_TYPE') != 'application/json'