BadRequestObjectResult 没有return 详细的错误信息给客户端

BadRequestObjectResult does not return detailed error message to the client

我有一个带有 HTTP 触发器的 Azure 函数。当未指定输入值时,它会产生 400 响应:

if (string.IsNullOrEmpty(artistName))
{
    return new BadRequestObjectResult("Artist name not specified.");
}

当函数在本地运行(func host start)并且错误调用API(我使用的是curl -X POST ...)时,会显示上述错误信息。

当部署到 Azure 并以类似方式调用时 - 而不是详细的错误消息 - 仅返回 Bad Request

为什么?
我怎样才能改变这种行为?

函数运行时 2.0.11888 的一个已知问题是 HttpTrigger 没有 return 正确响应内容。

如果您想解决这个问题,请转到应用程序设置,将您的 FUNCTIONS_EXTENSION_VERSION 固定到以前的运行时 2.0.11857-alpha,直到发布新版本。

参见 Azure Functions Runtime 2.0.11888 Preview

更新

此问题已在 2.0.11933 中得到解决。