fix(api-key): error details not passed to response (#7692)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Maxwell
2026-02-18 22:31:37 +08:00
committed by Alex Yang
co-authored by Alex Yang
parent defcb362fe
commit 8fd94d3c83
2 changed files with 3 additions and 0 deletions
@@ -3000,6 +3000,8 @@ describe("api-key", async () => {
const result3 = await auth.api.verifyApiKey({ body: { key: key.key } });
expect(result3.valid).toBe(false);
expect(result3.error?.code).toBe("RATE_LIMITED");
expect(result3.error).toHaveProperty("details");
expect((result3.error as any)?.details).toHaveProperty("tryAgainIn");
});
it("should defer remaining count updates", async () => {
@@ -311,6 +311,7 @@ export function verifyApiKey({
return ctx.json({
valid: false,
error: {
...error.body,
message: error.body?.message,
code: error.body?.code as string,
},