in 4-serverless-cicd-stack/static-service-cicd/static_cicd/static_cicd_stack.py [0:0]
def add_cors_options(self, apigw_resource):
apigw_resource.add_method('OPTIONS', _apigw.MockIntegration(
integration_responses=[{
'statusCode': '200',
'responseParameters': {
'method.response.header.Access-Control-Allow-Headers': "'cache-control,Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",
'method.response.header.Access-Control-Allow-Origin': "'*'",
'method.response.header.Access-Control-Allow-Methods': "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
}
}
],
passthrough_behavior=_apigw.PassthroughBehavior.WHEN_NO_MATCH,
request_templates={"application/json":"{\"statusCode\":200}"}
),
method_responses=[{
'statusCode': '200',
'responseParameters': {
'method.response.header.Access-Control-Allow-Headers': True,
'method.response.header.Access-Control-Allow-Methods': True,
'method.response.header.Access-Control-Allow-Origin': True,
}
}
],