Skip to content

Commit

Permalink
fix(firebase-auth): throw HTTPException for bad request (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
Code-Hex committed Oct 6, 2023
1 parent 4eb3eb5 commit 152e93e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/make-http-exception-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/firebase-auth': patch
---

fixed to make HTTPException instead of reponse null for bad request
3 changes: 2 additions & 1 deletion packages/firebase-auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ export const verifyFirebaseAuth = (userConfig: VerifyFirebaseAuthConfig): Middle
return async (c, next) => {
const authorization = c.req.headers.get(config.AuthorizationHeaderKey)
if (authorization === null) {
return new Response(null, {
const res = new Response('Bad Request', {
status: 400,
})
throw new HTTPException(400, { res })
}
const jwt = authorization.replace(/Bearer\s+/i, '')
const auth = Auth.getOrInitialize(
Expand Down

0 comments on commit 152e93e

Please sign in to comment.