本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
x-amazon-apigateway-gateway-回應。 gatewayResponse 物件
定義指定回應類型的閘道回應,包括狀態碼、任何適用的回應參數,或回應範本。
屬性名稱 | 類型 | 描述 |
---|---|---|
|
x-amazon-apigateway-gateway-回應。 responseParameters |
指定GatewayResponse參數,即標題參數。該參數值可使用任何傳入請求參數值或靜態自訂值。 |
|
x-amazon-apigateway-gateway-回應。 responseTemplates |
指定閘道回應的對應範本。VTL引擎不會處理範本。 |
|
string |
閘道回應的HTTP狀態碼。 |
x-amazon-apigateway-gateway-回應。 gatewayResponse 例子
下列要開啟的 API Gateway 延伸範例APIGatewayResponse定義了自訂INVALID_API_KEY
回應以傳回狀態碼456
、傳入要求的api-key
標頭值和"Bad api-key"
訊息。
"INVALID_API_KEY": { "statusCode": "456", "responseParameters": { "gatewayresponse.header.api-key": "method.request.header.api-key" }, "responseTemplates": { "application/json": "{\"message\": \"Bad api-key\" }" } }