From 22a4ed27e262cbf13cb0df14df32a2c4bc2a0c9d Mon Sep 17 00:00:00 2001 From: Wing-Kam Date: Wed, 3 Jun 2020 20:39:49 +0800 Subject: [PATCH] refactor: Replace `_.toUpper(string)` with `string.toUpperCase` (#7808) --- lib/classes/Utils.js | 6 +++--- .../compile/events/apiGateway/lib/method/integration.js | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/classes/Utils.js b/lib/classes/Utils.js index a0a44112b..270016409 100644 --- a/lib/classes/Utils.js +++ b/lib/classes/Utils.js @@ -220,9 +220,9 @@ class Utils { if (_.has(event, 'http.authorizer')) { if ( (_.isString(event.http.authorizer) && - _.toUpper(event.http.authorizer) === 'AWS_IAM') || + event.http.authorizer.toUpperCase() === 'AWS_IAM') || (event.http.authorizer.type && - _.toUpper(event.http.authorizer.type) === 'AWS_IAM') + event.http.authorizer.type.toUpperCase() === 'AWS_IAM') ) { hasIAMAuthorizer = true; } @@ -235,7 +235,7 @@ class Utils { if ( (_.isString(event.http.authorizer) && - _.toUpper(event.http.authorizer) !== 'AWS_IAM' && + event.http.authorizer.toUpperCase() !== 'AWS_IAM' && !awsArnRegExs.cognitoIdpArnExpr.test(event.http.authorizer)) || event.http.authorizer.name || (event.http.authorizer.arn && diff --git a/lib/plugins/aws/package/compile/events/apiGateway/lib/method/integration.js b/lib/plugins/aws/package/compile/events/apiGateway/lib/method/integration.js index 94bcbbf75..65b396727 100644 --- a/lib/plugins/aws/package/compile/events/apiGateway/lib/method/integration.js +++ b/lib/plugins/aws/package/compile/events/apiGateway/lib/method/integration.js @@ -82,9 +82,10 @@ module.exports = { }, }); } else if (type === 'HTTP' || type === 'HTTP_PROXY') { + const integrationHttpMethod = (http.request && http.request.method) || http.method; Object.assign(integration, { Uri: http.request && http.request.uri, - IntegrationHttpMethod: _.toUpper((http.request && http.request.method) || http.method), + IntegrationHttpMethod: integrationHttpMethod.toUpperCase(), }); if (http.connectionType) { Object.assign(integration, {