问题描述
我正在使用connexion编写python服务。我可以通过localhost:<port>/ui
访问该服务的一般GUI。但是,当我在浏览器中输入localhost:<port>
而没有/ui
(由connexion添加的automatically)时,出现以下消息:
{
"detail": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.","status": 404,"title": "Not Found","type": "about:blank"
}
是否可以自定义此消息?就我而言,我希望localhost:<port>
返回以下消息:
{"message": "check /ui to have access to the Swagger UI"}
解决方法
我想我找到了解决方案。只需将以下内容添加到openspec api:
/:
get:
operationId: path.to.function
summary: "my personlized message"
responses:
......