From 4f9b390cd6f4cbf924e068450a8ce1a10784b455 Mon Sep 17 00:00:00 2001 From: Juho Hautala Date: Tue, 25 Jun 2024 17:59:20 -0700 Subject: [PATCH 1/2] Fix failing test --- test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.js b/test/index.js index 79cf342..208a5e8 100644 --- a/test/index.js +++ b/test/index.js @@ -79,7 +79,7 @@ describe('hCaptcha', function () { verify(secret, token) .then(done.fail) .catch(error => { - assert.strictEqual(error.message, 'Unexpected token < in JSON at position 0') + assert.match(error.message, /unexpected token/i); done() }); }); From 68640b46cdbd21a950ae7447a3e7788fcc662e2a Mon Sep 17 00:00:00 2001 From: Juho Hautala Date: Tue, 25 Jun 2024 18:40:03 -0700 Subject: [PATCH 2/2] types: Add missing fields to VerifyResponse --- index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.d.ts b/index.d.ts index f67413a..a607c37 100644 --- a/index.d.ts +++ b/index.d.ts @@ -20,6 +20,12 @@ type VerifyResponse = { /** List of error codes. Present if success is false */ "error-codes"?: string[], + + /** A score denoting malicious activity. (Optional b/c of ENTERPRISE feature) */ + score?: number, + + /** Reason(s) for score. (Optional b/c of ENTERPRISE feature) */ + score_reason?: string[], }; declare module "hcaptcha" {