how to get access to error message from abort command when using custom error handler

前端 未结 4 2006
心在旅途
心在旅途 2020-12-03 04:23

Using a python flask server, I want to be able to throw an http error response with the abort command and use a custom response string and a custom message in the body

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-03 04:39

    flask.abort also accepts flask.Response

    abort(make_response(jsonify(message="Error message"), 400))
    

提交回复
热议问题