如何在基于python的Azure函数中添加"health" HEAD请求?

How do I add "health" HEAD request in Azure function based on python?

我正在为无服务器 python 函数使用 Azure 函数 HTTP 触发器。 Azure 函数有一个端点 (http://localhost:7071/api/func_name?param1=value1)。 对于健康检查,我将添加另一个端点(作为 HEAD 请求)。 也许这个端点可以形成为: http://localhost:7071/api/func_name/health. 如何在 Azure 函数中添加此端点? 如果有任何建议,我们将不胜感激。 谢谢

对于此要求,您可以创建另一个函数端点(创建另一个 httptrigger),然后在其 function.json 中添加一个 route 属性("route":"func_name/health"),如下所示截图:

然后您可以使用 url http://localhost:7071/api/func_name/health

请求新的函数端点