代码之家  ›  专栏  ›  技术社区  ›  tutuca

从响应中删除添加的错误信息

  •  0
  • tutuca  · 技术社区  · 7 年前

    使用flask restplus,我注意到如果我处理一些错误,比如:

    api.abort(code=404, message='Item not found')
    

    响应呈现:

    {
      "message": "Item not found. You have requested this URI [/item/1]
                  but did you mean /item/<item_id> ?"
    }
    

    我真的不需要额外的信息,但找不到删除它的方法。

    有吗?

    0 回复  |  直到 7 年前
        1
  •  2
  •   tutuca    7 年前

    所以,这里有一个配置标志。 Reported here

    ERROR_404_HELP=False
    

    做的诀窍