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

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -