Everything runs fine, API(flask) returns the data nicely. However, when I try to customise the response code, I can't do it.
Following are the two ways, I tried:
from flask import make_response dictionary = {1:'a', 2:'b'} resp = make_response(dictionary,1001) return resp #In developer tools, I could see the data, but status-code is 200 .
from flask import Response dictionary = {1:'a', 2:'b'} resp = Response(dictionary, status = 1001) return resp #Here again, I see the data, but the status code is 200 How do I set the status code to be something else?
return Response("{1:'a', 2:'b'}", status=201, mimetype='application/json').Btw,1001is not a valid HTTP status code