5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/jets/resource/api_gateway/cors.rb', line 5
def definition
{
cors_logical_id => {
type: "AWS::ApiGateway::Method",
properties: {
resource_id: "!Ref #{resource_id}",
rest_api_id: "!Ref #{RestApi.logical_id}",
authorization_type: cors_authorization_type,
http_method: "OPTIONS",
method_responses: [{
status_code: '200',
response_parameters: {
"method.response.header.Access-Control-Allow-Origin": true,
"method.response.header.Access-Control-Allow-Headers": true,
"method.response.header.Access-Control-Allow-Methods": true,
"method.response.header.Access-Control-Allow-Credentials": true,
},
response_models: {},
}],
request_parameters: {},
integration: {
type: "MOCK",
request_templates: {
"application/json": "{statusCode:200}",
},
integration_responses: [{
status_code: '200',
response_parameters: {
"method.response.header.Access-Control-Allow-Origin": "'#{allow_origin}'",
"method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'",
"method.response.header.Access-Control-Allow-Methods": "'OPTIONS,GET'",
"method.response.header.Access-Control-Allow-Credentials": "'false'",
},
response_templates: {
"application/json": '',
},
}]
}
}
}
}
end
|