如何使用 Serverless + OpenWhisk 和 IBM Cloud API Gateway return 非 200 HTTP 状态代码?
How to return non 200 HTTP status codes with Serverless + OpenWhisk and behind IBM Cloud API Gateway?
我不知道如何 return API GW 后面的功能的 http 状态代码。无论我 return,它总是返回 200。我已经尝试 statusCode
和 code
无济于事。
我正在使用带有 OpenWhisk 插件的无服务器框架。我正在部署到 IBM Cloud。
Web 操作响应内容类型参数必须设置为 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
我不知道如何 return API GW 后面的功能的 http 状态代码。无论我 return,它总是返回 200。我已经尝试 statusCode
和 code
无济于事。
我正在使用带有 OpenWhisk 插件的无服务器框架。我正在部署到 IBM Cloud。
Web 操作响应内容类型参数必须设置为 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