I'm trying to add a GET Response to my API Gateway with AWS CDK. However, I get this Error when I do cdk deploy:
Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression parameter specified: method.response.header.Content-Type] (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: f4b6ec17-f0ae-4e2a-aa18-b86ddcac807a; Proxy: null)
My Code:
const admin = api.root.addResource('admin');
admin.addMethod(
'GET',
new apigw.LambdaIntegration(hmtl_code, {
passthroughBehavior: apigw.PassthroughBehavior.WHEN_NO_MATCH,
requestTemplates: { 'application/json': '{"statusCode": 200}' },
integrationResponses: [
{
statusCode: "200",
responseParameters: {
'method.response.header.Content-Type': "'text/html'"
},
responseTemplates: { "text/html": "$input.path('$')" }
}
]
}),
{
methodResponses: [
{
statusCode: "200",
}
]
}
);
I tried it with a MockIntegration as well, but this Error message keeps popping up. Help would be appreciated, thanks :)