mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-19 23:53:17 -05:00
fix(api-key): error details not passed to response (#7692)
Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
committed by
Alex Yang
co-authored by
Alex Yang
parent
defcb362fe
commit
8fd94d3c83
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user