x-amazon-apigateway-gateway-responses.gatewayRespon - Amazon API Gateway
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

x-amazon-apigateway-gateway-responses.gatewayRespon

定义了给定响应类型的网关响应,包括状态代码、任何适用的响应参数或响应模板。

属性
属性名称 类型 描述
responseParameters x-amazon-apigateway-gateway-responses.responseparam

指定GatewayResponse参数,即标题参数。参数值可以采用任何传入请求参数值或静态自定义值。

responseTemplates x-amazon-apigateway-gateway-响应。响应模板

指定网关响应的映射模板。这些模板不由 VTL 引擎处理。

statusCode string

网关响应的 HTTP 状态代码。

x-amazon-apigateway-gateway-responses.gateway响应示例

以下 OpenAPI 的 API Gatewa GatewayResponsey 扩展示例定义了自定义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\" }" } }