Reputation: 23932
Is there a way to set a GatewayResponse for an API Gateway in Cloudformation, with an empty response body (and ideally without response Content-Type)
I have tried with something like this:
InvalidApiKeyResponse:
Type: AWS::ApiGateway::GatewayResponse
Properties:
ResponseType: INVALID_API_KEY
RestApiId: !Ref RestApi
StatusCode: 403
but it still returns the default application/json response.
In the AWS dashboard, when I try to set an empty response I get the following error: Invalid null or empty value in responseTemplates
Upvotes: 1
Views: 595
Reputation: 33
Try adding in the ResponseTemplates piece below.
GatewayResponse:
Type: AWS::ApiGateway::GatewayResponse
Properties:
ResponseTemplates:
application/json: ""
ResponseType: INVALID_API_KEY
RestApiId: !Ref RestApi
StatusCode: 403
Upvotes: 1