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

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

x-amazon-apigateway-gateway-响应对象

将 API 的网关响应定义为键值对的字符串对GatewayResponse映射。扩展适用于根级 OpenAPI 结构。

属性
属性名称 类型 描述
responseType x-amazon-apigateway-gateway-responses.Gateway响应

指定 responseTypeGatewayResponse

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

以下 OpenAPI 的 API Gateway 扩展示例定义了一个包含两个GatewayResponse实例的GatewayResponses地图,一个用于类型,另一个用于DEFAULT_4XX类型。INVALID_API_KEY

{ "x-amazon-apigateway-gateway-responses": { "DEFAULT_4XX": { "responseParameters": { "gatewayresponse.header.Access-Control-Allow-Origin": "'domain.com'" }, "responseTemplates": { "application/json": "{\"message\": test 4xx b }" } }, "INVALID_API_KEY": { "statusCode": "429", "responseTemplates": { "application/json": "{\"message\": test forbidden }" } } } }