How can a message body be added to a 404 response in flask?
The following attempts will generate a 404 but without the message:
@app.route('/fruit/<fruit_name>', methods=["GET"])
def fruit_route(fruit_name):
if fruit_name == "tomato":
return "I don't care what they say, tomato is not a fruit", 404
return "yummy"
@app.route('/fruit/<fruit_name>', methods=["GET"])
def fruit_route(fruit_name):
if fruit_name == "tomato":
flask.abort(404,"I don't care what they say, tomato is not a fruit")
return "yummy"
Thank you in advance for your consideration and response.