Skip to content

Commit 069dfb9

Browse files
committed
change async way
1 parent 19f0b3a commit 069dfb9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/package/kinesis/compileMethodsToKinesis.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const _ = require('lodash')
66
module.exports = {
77
async compileMethodsToKinesis() {
88
this.apiGatewayMethodLogicalIds = []
9-
this.validated.events.forEach((event) => {
9+
this.validated.events.forEach(async (event) => {
1010
const resourceId = this.getResourceId(event.http.path)
1111
const resourceName = this.getResourceName(event.http.path)
1212

@@ -24,8 +24,8 @@ module.exports = {
2424

2525
_.merge(
2626
template,
27-
this.getKinesisMethodIntegration(event.http),
28-
this.getMethodResponses(event.http)
27+
await this.getKinesisMethodIntegration(event.http),
28+
await this.getMethodResponses(event.http)
2929
)
3030

3131
const methodLogicalId = this.provider.naming.getMethodLogicalId(
@@ -43,7 +43,7 @@ module.exports = {
4343
return BbPromise.resolve()
4444
},
4545

46-
getKinesisMethodIntegration(http) {
46+
async getKinesisMethodIntegration(http) {
4747
const integration = {
4848
IntegrationHttpMethod: 'POST',
4949
Type: 'AWS',
@@ -63,7 +63,7 @@ module.exports = {
6363
]
6464
},
6565
PassthroughBehavior: 'NEVER',
66-
RequestTemplates: this.getKinesisIntegrationRequestTemplates(http)
66+
RequestTemplates: await this.getKinesisIntegrationRequestTemplates(http)
6767
}
6868

6969
const integrationResponse = {
@@ -89,7 +89,7 @@ module.exports = {
8989
origin = http.cors.origins.join(',')
9090
}
9191

92-
integrationResponse.IntegrationResponses.forEach((val, i) => {
92+
integrationResponse.IntegrationResponses.forEach(async (val, i) => {
9393
integrationResponse.IntegrationResponses[i].ResponseParameters = {
9494
'method.response.header.Access-Control-Allow-Origin': `'${origin}'`
9595
}
@@ -105,19 +105,19 @@ module.exports = {
105105
}
106106
},
107107

108-
getKinesisIntegrationRequestTemplates(http) {
109-
const defaultRequestTemplates = this.getDefaultKinesisRequestTemplates(http)
108+
async getKinesisIntegrationRequestTemplates(http) {
109+
const defaultRequestTemplates = await this.getDefaultKinesisRequestTemplates(http)
110110
return Object.assign(defaultRequestTemplates, _.get(http, ['request', 'template']))
111111
},
112112

113-
getDefaultKinesisRequestTemplates(http) {
113+
async getDefaultKinesisRequestTemplates(http) {
114114
return {
115-
'application/json': this.buildDefaultKinesisRequestTemplate(http),
116-
'application/x-www-form-urlencoded': this.buildDefaultKinesisRequestTemplate(http)
115+
'application/json': await this.buildDefaultKinesisRequestTemplate(http),
116+
'application/x-www-form-urlencoded': await this.buildDefaultKinesisRequestTemplate(http)
117117
}
118118
},
119119

120-
buildDefaultKinesisRequestTemplate(http) {
120+
async buildDefaultKinesisRequestTemplate(http) {
121121
let streamName
122122
if (typeof http.streamName == 'object') {
123123
streamName = http.streamName

0 commit comments

Comments
 (0)