BadRequestObjectResult不会向客户端返回详细的错误消息

时间:2018-07-07 08:29:51

标签: azure azure-functions azure-functions-runtime

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

int groupSize = 300;
var numberOfGroups = Quotient + (Remainder > 0 ? 1 : 0); // If there is any remainder then add it as another loop.
for (int i = 0; i < numberOfGroups; i++)
{
    List<string> myNewString = tempSMSNoList.Skip(i*groupSize).Take(groupSize).ToList();
}

当函数在本地运行(if (string.IsNullOrEmpty(artistName)) { return new BadRequestObjectResult("Artist name not specified."); } )并且API被错误地调用(我正在使用func host start)时,显示以上错误消息。

部署到Azure并以类似方式调用-而不是详细的错误消息-仅返回curl -X POST ...

为什么?
我该如何改变这种行为?

1 个答案:

答案 0 :(得分:2)

函数运行时2.0.11888的一个已知问题是HttpTrigger无法正确返回响应内容。

如果要解决此问题,请转到“应用程序设置”,将FUNCTIONS_EXTENSION_VERSION固定到先前的运行时2.0.11857-alpha,直到发布新版本为止。

请参见Azure Functions Runtime 2.0.11888 Preview

更新

此问题已从2.0.11933中修复。

相关问题