【发布时间】:2017-05-25 01:25:35
【问题描述】:
我正在尝试通过我的 AWS Gateway 返回状态错误代码(例如 500、400、401),但似乎无法弄清楚。
我看过一些例子,他们做了如下的事情:
return context.fail('Bad Request: You submitted invalid input');
但是,ILambdaContext 对象上没有失败或成功方法。
这是我到目前为止所得到的(非工作)
Lambda 代码:
var addressresponse = new AddressValidationResponse();
addressresponse.Errors = new string[1];
addressresponse.Errors[0] = "test error";
addressresponse.Reason = "client_error";
return addressresponse;
我想我已经接近了,但我仍然得到了 200 的回复:
{
"Reason": "client_error",
"Errors": [
"test error"
]
}
我在这里错过了什么?
【问题讨论】:
标签: c# amazon-web-services aws-lambda aws-api-gateway