allow cross origin content-type header
This commit is contained in:
parent
b6dcccb230
commit
f44584f131
1 changed files with 2 additions and 0 deletions
|
@ -17,6 +17,8 @@ def api(request):
|
||||||
response = render_to_json_response({'status': {'code': 200,
|
response = render_to_json_response({'status': {'code': 200,
|
||||||
'text': 'use POST'}})
|
'text': 'use POST'}})
|
||||||
response['Access-Control-Allow-Origin'] = '*'
|
response['Access-Control-Allow-Origin'] = '*'
|
||||||
|
response['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
|
||||||
|
response['Access-Control-Allow-Headers'] = 'Content-Type'
|
||||||
return response
|
return response
|
||||||
if request.META['REQUEST_METHOD'] != "POST" or (
|
if request.META['REQUEST_METHOD'] != "POST" or (
|
||||||
not 'action' in request.POST and request.META.get('CONTENT_TYPE') != 'application/json'
|
not 'action' in request.POST and request.META.get('CONTENT_TYPE') != 'application/json'
|
||||||
|
|
Loading…
Reference in a new issue