fix(firebase-auth): throw HTTPException for bad request (#194)
parent
4eb3eb5e5a
commit
152e93e598
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@hono/firebase-auth': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fixed to make HTTPException instead of reponse null for bad request
|
|
@ -39,9 +39,10 @@ export const verifyFirebaseAuth = (userConfig: VerifyFirebaseAuthConfig): Middle
|
||||||
return async (c, next) => {
|
return async (c, next) => {
|
||||||
const authorization = c.req.headers.get(config.AuthorizationHeaderKey)
|
const authorization = c.req.headers.get(config.AuthorizationHeaderKey)
|
||||||
if (authorization === null) {
|
if (authorization === null) {
|
||||||
return new Response(null, {
|
const res = new Response('Bad Request', {
|
||||||
status: 400,
|
status: 400,
|
||||||
})
|
})
|
||||||
|
throw new HTTPException(400, { res })
|
||||||
}
|
}
|
||||||
const jwt = authorization.replace(/Bearer\s+/i, '')
|
const jwt = authorization.replace(/Bearer\s+/i, '')
|
||||||
const auth = Auth.getOrInitialize(
|
const auth = Auth.getOrInitialize(
|
||||||
|
|
Loading…
Reference in New Issue