diff options
| author | Frank <[email protected]> | 2025-07-11 05:23:17 +0800 |
|---|---|---|
| committer | Frank <[email protected]> | 2025-07-11 05:23:24 +0800 |
| commit | 766bfd025c6fe515f7b5ad2bf8304b77bcacba47 (patch) | |
| tree | 477cdc1702008dcf6f0dda123d86e8f974e6cc1d /packages/function | |
| parent | c7f30e1065c666f8eb687db75bdc06ce4b8c4882 (diff) | |
| download | opencode-766bfd025c6fe515f7b5ad2bf8304b77bcacba47.tar.gz opencode-766bfd025c6fe515f7b5ad2bf8304b77bcacba47.zip | |
wip: github actions
Diffstat (limited to 'packages/function')
| -rw-r--r-- | packages/function/src/api.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/function/src/api.ts b/packages/function/src/api.ts index 3ba3d71d1..12b54c844 100644 --- a/packages/function/src/api.ts +++ b/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)) |
