Pārlūkot izejas kodu

wip: github actions

Frank 9 mēneši atpakaļ
vecāks
revīzija
766bfd025c
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  1. 5 1
      packages/function/src/api.ts

+ 5 - 1
packages/function/src/api.ts

@@ -230,7 +230,11 @@ export default {
       // get Authorization header
       const authHeader = request.headers.get("Authorization")
       const token = authHeader?.replace(/^Bearer /, "")
-      if (!token) return new Response("Error: authorization header is required", { status: 401 })
+      if (!token)
+        return new Response(JSON.stringify({ error: "Authorization header is required" }), {
+          status: 401,
+          headers: { "Content-Type": "application/json" },
+        })
 
       // verify token
       const JWKS = createRemoteJWKSet(new URL(JWKS_URL))