From 743f66c13acc7c93f09fdd5b43a2017a6e52454c Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Wed, 11 Sep 2024 15:25:08 +0900 Subject: [PATCH] fix(bearer-auth): typo (#3404) --- src/middleware/bearer-auth/index.test.ts | 8 ++++---- src/middleware/bearer-auth/index.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/middleware/bearer-auth/index.test.ts b/src/middleware/bearer-auth/index.test.ts index 8c017f48e..4dca87f22 100644 --- a/src/middleware/bearer-auth/index.test.ts +++ b/src/middleware/bearer-auth/index.test.ts @@ -126,7 +126,7 @@ describe('Bearer Auth by Middleware', () => { '/auth-custom-invalid-authentication-header-message-string/*', bearerAuth({ token, - invalidAuthenticationHeaderMeasage: + invalidAuthenticationHeaderMessage: 'Custom invalid authentication header message as string', }) ) @@ -139,7 +139,7 @@ describe('Bearer Auth by Middleware', () => { '/auth-custom-invalid-authentication-header-message-object/*', bearerAuth({ token, - invalidAuthenticationHeaderMeasage: { + invalidAuthenticationHeaderMessage: { message: 'Custom invalid authentication header message as object', }, }) @@ -153,7 +153,7 @@ describe('Bearer Auth by Middleware', () => { '/auth-custom-invalid-authentication-header-message-function-string/*', bearerAuth({ token, - invalidAuthenticationHeaderMeasage: () => + invalidAuthenticationHeaderMessage: () => 'Custom invalid authentication header message as function string', }) ) @@ -166,7 +166,7 @@ describe('Bearer Auth by Middleware', () => { '/auth-custom-invalid-authentication-header-message-function-object/*', bearerAuth({ token, - invalidAuthenticationHeaderMeasage: () => ({ + invalidAuthenticationHeaderMessage: () => ({ message: 'Custom invalid authentication header message as function object', }), }) diff --git a/src/middleware/bearer-auth/index.ts b/src/middleware/bearer-auth/index.ts index a8db32f43..0e86d4d47 100644 --- a/src/middleware/bearer-auth/index.ts +++ b/src/middleware/bearer-auth/index.ts @@ -23,7 +23,7 @@ type BearerAuthOptions = headerName?: string hashFunction?: Function noAuthenticationHeaderMessage?: string | object | MessageFunction - invalidAuthenticationHeaderMeasage?: string | object | MessageFunction + invalidAuthenticationHeaderMessage?: string | object | MessageFunction invalidTokenMessage?: string | object | MessageFunction } | { @@ -33,7 +33,7 @@ type BearerAuthOptions = verifyToken: (token: string, c: Context) => boolean | Promise hashFunction?: Function noAuthenticationHeaderMessage?: string | object | MessageFunction - invalidAuthenticationHeaderMeasage?: string | object | MessageFunction + invalidAuthenticationHeaderMessage?: string | object | MessageFunction invalidTokenMessage?: string | object | MessageFunction } @@ -127,7 +127,7 @@ export const bearerAuth = (options: BearerAuthOptions): MiddlewareHandler => { c, 400, `${wwwAuthenticatePrefix}error="invalid_request"`, - options.invalidAuthenticationHeaderMeasage || 'Bad Request' + options.invalidAuthenticationHeaderMessage || 'Bad Request' ) } else { let equal = false