Skip to content

Commit

Permalink
refactor: re-activate unicorn/prefer-ternary
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Sep 20, 2023
1 parent d89fef7 commit 4606829
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
1 change: 0 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ module.exports = {
'unicorn/prefer-module': 'off',
'unicorn/prefer-spread': 'off',
'unicorn/prefer-string-slice': 'off',
'unicorn/prefer-ternary': 'off',
'unicorn/prevent-abbreviations': 'off',
},
}
10 changes: 3 additions & 7 deletions src/events/alb/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,9 @@ export default class HttpServer {
if (request.method === 'options') {
response.statusCode = 200

if (request.headers['access-control-expose-headers']) {
response.headers['access-control-expose-headers'] =
request.headers['access-control-expose-headers']
} else {
response.headers['access-control-expose-headers'] =
'content-type, content-length, etag'
}
response.headers['access-control-expose-headers'] =
request.headers['access-control-expose-headers'] ||
'content-type, content-length, etag'
response.headers['access-control-max-age'] = 60 * 10

if (request.headers['access-control-request-headers']) {
Expand Down
10 changes: 3 additions & 7 deletions src/events/http/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,9 @@ export default class HttpServer {
if (request.method === 'options') {
response.statusCode = 200

if (request.headers['access-control-expose-headers']) {
response.headers['access-control-expose-headers'] =
request.headers['access-control-expose-headers']
} else {
response.headers['access-control-expose-headers'] =
'content-type, content-length, etag'
}
response.headers['access-control-expose-headers'] =
request.headers['access-control-expose-headers'] ||
'content-type, content-length, etag'
response.headers['access-control-max-age'] = 60 * 10

if (request.headers['access-control-request-headers']) {
Expand Down
13 changes: 3 additions & 10 deletions src/events/http/createAuthScheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,10 @@ export default function createAuthScheme(authorizerOptions, provider, lambda) {

// methodArn is the ARN of the function we are running we are authorizing access to (or not)
// Account ID and API ID are not simulated
if (authorizerOptions.type === 'request') {
event = {
...event,
type: 'REQUEST',
}
} else {
event = {
...event,
// This is safe since type: 'TOKEN' cannot have payload format 2.0
event = {
...event,
type: 'TOKEN',
}
type: authorizerOptions.type === 'request' ? 'REQUEST' : 'TOKEN',
}

const lambdaFunction = lambda.get(authFunName)
Expand Down

0 comments on commit 4606829

Please sign in to comment.