Skip to content

Commit

Permalink
moved to Django's JsonResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
ajinabraham committed Sep 6, 2018
1 parent a9326ba commit 7bf2b14
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions MobSF/views/api/rest_api.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
MobSF REST API V 1
"""
import json

from django.http import (
HttpResponse
HttpResponse,
JsonResponse
)
from django.views.decorators.csrf import csrf_exempt

Expand Down Expand Up @@ -32,17 +32,11 @@

def make_api_response(data, status=200):
"""Make API Response"""
api_resp = HttpResponse(
json.dumps(data,
sort_keys=True,
indent=4,
separators=(',', ': ')),
content_type="application/json; charset=utf-8",
status=status)
api_resp['Access-Control-Allow-Origin'] = '*'
api_resp['Access-Control-Allow-Methods'] = 'POST'
api_resp['Access-Control-Allow-Headers'] = 'Authorization'
return api_resp
resp = JsonResponse(data=data, status=status)
resp['Access-Control-Allow-Origin'] = '*'
resp['Access-Control-Allow-Methods'] = 'POST'
resp['Access-Control-Allow-Headers'] = 'Authorization'
return resp


def api_auth(meta):
Expand Down

0 comments on commit 7bf2b14

Please sign in to comment.