0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-24 11:07:29 +01:00

fix(bearer-auth): typo (#3404)

This commit is contained in:
Yusuke Wada 2024-09-11 15:25:08 +09:00 committed by GitHub
parent c240ea5590
commit 743f66c13a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -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',
}),
})

View File

@ -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<boolean>
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