Skip to content

Commit 3c31406

Browse files
committed
refactor: switch common function for cors
1 parent b58fe78 commit 3c31406

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ curl https://xxxxxx.execute-api.us-east-1.amazonaws.com/dev/sns -d '{"message":
306306

307307
### DynamoDB
308308

309-
Sample syntax for DynamoDB proxy in `serverless.yml`. Currently, the supported (DynamoDB Operations)[https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Operations.html] are `PutItem`, `GetItem` and `DeleteItem`.
309+
Sample syntax for DynamoDB proxy in `serverless.yml`. Currently, the supported [DynamoDB Operations](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Operations.html) are `PutItem`, `GetItem` and `DeleteItem`.
310310

311311
```yaml
312312
custom:

lib/package/dynamodb/compileMethodsToDynamodb.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,7 @@ module.exports = {
8484
]
8585
}
8686

87-
if (http && http.cors) {
88-
let origin = http.cors.origin
89-
if (http.cors.origins && http.cors.origins.length) {
90-
origin = http.cors.origins.join(',')
91-
}
92-
93-
integrationResponse.IntegrationResponses.forEach(async (val, i) => {
94-
integrationResponse.IntegrationResponses[i].ResponseParameters = {
95-
'method.response.header.Access-Control-Allow-Origin': `'${origin}'`
96-
}
97-
})
98-
}
87+
this.addCors(http, integrationResponse)
9988

10089
_.merge(integration, integrationResponse)
10190

0 commit comments

Comments
 (0)