我无法弄清楚如何为函数返回的HTTP状态代码的API GW后面。不管是什么我回来,它总是回来为200。我已经试过statusCode
和code
无济于事。
我使用的是与OpenWhisk插件无服务器架构。我部署到IBM云。
网络行动响应内容类型参数必须设置为http
手动configure the HTTP response。此值默认为json
而忽略返回headers
和statusCode
值。
在无服务器框架,该值在YAML的event configuration section设置。
functions:
my_function:
handler: index.main
events:
- http:
method: GET
path: /api/greeting
resp: http