A consumer of my REST API says that on occasion I am returning a 400 Bad Request - The request sent by the client was syntactically incorrect. error.>
400 Bad Request
The request sent by the client was syntactically incorrect.
you can return the status code as a second parameter of the return, see example below
return
@app.route('/my400') def my400(): code = 400 msg = 'my message' return msg, code