python - Django JSON response error status -
my api returning json object on error status code http 200
:
response = jsonresponse({'status': 'false', 'message': message}) return response
how can change response code indicate error?
jsonresponse
returns http 200
, status code 'ok'
. in order indicate error, can add http status code jsonresponse
subclass of httpresponse
:
response = jsonresponse({'status':'false','message':message}, status=500)
Comments
Post a Comment